Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9295 closed bug (fixed)

Deadlock in forkProcess

Reported by: edsko Owned by:
Priority: normal Milestone: 7.8.4
Component: Compiler Version: 7.8.2
Keywords: Cc: snoyberg, AndreasVoellmy
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D59
Wiki Page:


As part of forkProcess we discard all tasks except the one task that remains. As part of this we call freeTask, and freeTask in turn calls closeCondition and closeMutex, which are very thin wrappers around pthread_cond_destroy and phread_mutex_destroy. However, the behaviour of these functions is undefined when there are currently threads blocked on these condition variables/mutexes. In reality, this undefined behaviour often (though not always) results in a deadlock. Unfortunately, I don't have a minimal test case to demonstrate this, but in the large system on which I am testing this I am seeing these deadlocks rather frequently.

For the global mutex we don't attempt to call pthread_cond_destroy or pthread_mutex_destroy, but instead re-initialize them. The patch

does precisely that for the condition variables and mutexes associated with tasks. This is somewhat or a long way around, because we will then subsequently still call pthread_..._destroy, but it means that we don't have to mess with freeTask.

Change History (6)

comment:1 Changed 5 years ago by snoyberg

Cc: snoyberg added

comment:2 Changed 5 years ago by AndreasVoellmy

Cc: AndreasVoellmy added

comment:3 Changed 5 years ago by thoughtpolice

Milestone: 7.8.3

comment:4 Changed 5 years ago by thoughtpolice

Differential Rev(s): Phab:D59

comment:5 Changed 5 years ago by thoughtpolice

Resolution: fixed
Status: newclosed

This was merged and will be part of 7.8.4.

comment:6 Changed 5 years ago by thomie

In case Phabricator references are not permanent: fixed in commit 39630ab15cc0607103dc4ef3d9089de44ef17c2d.

Note: See TracTickets for help on using tickets.