Red Hat Bugzilla – Bug 73386
Intermittent problems with pthread mutexes on dual-processor systems
Last modified: 2016-11-24 09:50:08 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1)
Description of problem:
I have a small test program that demonstrates a bug in
the pthreads library. Since the test program uses
several pthread features (mutexes, condition variables,
thread creation and join), it's not clear which feature
has a bug. I am guessing it's the mutexes because the
symptom of the bug is that a variable protected by a
mutex may have the wrong value.
The bug occurs rarely. I need to use a shell script to
run the test program repeatedly and often need to run it
for several minutes before it fails. I can make the
test program fail on dual-processor machines but haven't
been able to do that on uniprocessor machines.
The test program creates threads, which in turn create
additional threads and join with them. I wanted to
mention the recursive thread creation because two other
bugs (bug 43742 and bug 61353) occur under that condition.
I also want to mention that I can't reproduce this bug on
a dual-processor system running Red Hat Linux Advanced
Server release 2.1AS/i686, which has a newer kernel and
glibc than Red Hat Linux 7.2, so this bug may have been
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Compile the test program I am going to attach with
% gcc -pthread threads.c -o threads
2. Run it repeatedly with this shell script:
while ./threads; do
Actual Results: On a dual-processor Red Hat Linux 7.2 machine, you
will eventually hit the assertion failure
threads: threads.c:112: CreateThreads: Assertion `!locked' failed.
Expected Results: The script should be able to run the test program
repeatedly for hours without failure.
Created attachment 74784 [details]
Test program threads.c
This seems to work just fine on RHL9, even with the LinuxThreads libpthreads,
not only with NPTL.