Bug 211437

Summary: Bug in pthread_cond_wait in conjunction with thread cancellation.
Product: [Fedora] Fedora Reporter: Joachim Koetzing <joachim.koetzing>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-10-19 13:51:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
C++ program for testing the bug. none

Description Joachim Koetzing 2006-10-19 08:57:11 UTC
Description of problem:

When a thread which is currently waiting on a condition with pthread_cond_wait
() is cancelled with pthread_cancel() and shortly before that, the condition 
was signalled by pthread_cond_signal(), then the condition variable may become 
corrupted.

If the condition is reused afterwards the thread get stuck in pthread_cond_wait
().



Version-Release number of selected component (if applicable):
fc5, glibc-2.4-8 und
fc3, glibc-2.3.6-0.fc3.1


How reproducible:

See attached file.
If you execute the program, '+' charecters are displayed as long as all works 
fine. After a while the condition variable gets corrupted and then '-' 
characters are displayed. Though the main thread signals the condition 
repeatedly then, the side thread stucks in pthread_cond_wait.



Additional info:
A work around to the problem is to destroy and initialize again the condition 
variable after the thread was cancelled.

Comment 1 Joachim Koetzing 2006-10-19 08:57:14 UTC
Created attachment 138868 [details]
C++ program for testing the bug.

Comment 2 Jakub Jelinek 2006-10-19 13:51:02 UTC
This sounds very much like BZ#3123, which is fixed in glibc-2.4-11 (the current
FC-5 update glibc).  Certainly I couldn't reproduce the problem with your
testcase on dual G5 with glibc-2.4-11.