This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug nptl/654] Cancelling nptl thread on dlclose() leads to application hangup
- From: "jakub at redhat dot com" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 13 Jan 2005 13:15:12 -0000
- Subject: [Bug nptl/654] Cancelling nptl thread on dlclose() leads to application hangup
- References: <20050112104719.654.alexei.khlebnikov@datacon.at>
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
------- Additional Comments From jakub at redhat dot com 2005-01-13 13:15 -------
This is the same deadlock as has been fixed by:
2004-07-07 Ulrich Drepper <drepper@redhat.com>
* elf/dl-fini.c (_dl_fini): Move the unlock of the ld.so lock
before the loop running the destructors.
for destructors that are run at exit time.
ATM ld.so holds dl_load_lock when running shared library destructors and the
same lock is used indirectly by libgcc_s.so when unwinding. If you call
pthread_cancel in a shared library destructor that is run during dlclose,
dl_load_lock is held in the thread calling pthread_cancel, but the cancelled
thread needs to be unwound. As you also call pthread_join in the same destructor
that waits for the cancelled thread and the cancelled thread is waiting until
dl_load_lock is released (this would happen when dlclose is about to return),
they are deadlocking.
The fix is avoid running shared library destructors with dl_load_lock held,
but that's certainly not trivial.
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=654
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.