Bug#575302: Bug#654783: race condition in libpthread causes hangs in python2.7 testsuite
Petr Salinger
Petr.Salinger at seznam.cz
Fri Apr 20 06:47:05 UTC 2012
> That's really nice. Petr, could you give some explanation on that
> one-line patch you provided? Is it supposed to be the correct fix or
> is more work necessary? I'm not familiar with the whole picture but
> if you give some pointers I may be able to help.
In the original (plain linuxthreads) code, with thread implemented as
freebsd process, the wakeup signal is sent to thread manager from kernel,
after exit of thread.
In current variant, with thread implemented as freebsd kernel thread,
the wakeup signal is sent to thread manager from userspace, a few moments
before exit. It is an expected race condition. It is also the reason,
why "|| main_thread_exiting" have been added. I expected, that loss of a
wakeup does not matter, the "child thread" will be "eaten" only slightly
later, when another thread exits and sends wake up. The only problem
should be, when there is no another thread, it should be solved by
"|| main_thread_exiting". But it does not suffice.
The "try eat dead child" everytime is just workaround.
The better way might be to add atomic counter
[using gcc's __sync_fetch_and_add()] to track
the number of expected "dead or soon to be dead" child
and "try to eat dead child" when the number is above zero.
And (of course) in long term, do not use manager thread anymore.
Petr
More information about the pkg-mozilla-maintainers
mailing list