public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug linuxthreads/2948] New: Hang on exit if pthread_key_delete called after pthread_onexit_process
@ 2006-07-21 16:55 ian at airs dot com
  2006-07-21 16:55 ` [Bug linuxthreads/2948] " ian at airs dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ian at airs dot com @ 2006-07-21 16:55 UTC (permalink / raw)
  To: glibc-bugs

There is an obscure bug in linuxthreads.  I can recreate it under the following
conditions:

* gcc is configured without TLS support.

* The program is linked fully statically.

* The standard malloc is overridden.

* The program is linked against -lstdc++ (or -lsupc++).

Under this set of assumptions, the global destructor in
libstdc++/libsupc++/eh_globals.cc will be run after pthread_onexit_process is
run.  The global destructor will call pthread_key_delete.  pthread_key_delete
will attempt to contact the manager thread.  The manager thread will have
already exited.

The effect is that the program hangs after calling exit.

Now, to take the assumptions one by one:

* If gcc is configured with TLS support, then it uses __thread rather than
pthread_key_create/pthread_key_delete, so the program works.

* If the program is not linked fully statically, then -lpthread is linked after
-lstdc++, so its constructor runs first and its destructor runs last, so the
program works.

* malloc is called before global constructors are run, and the standard malloc
calls pthread_initialize the first time it is run, so if the standard malloc is
not overridden, then the program works.

* If the program is not linked against -lstdc++, then the eh_globals.cc
constructor is not run, so the destructor is not run, and the program works.

Is it worth fixing such an obscure case?  I don't know.  It happened to me, and
the patch is simple.

I will attach the test case and the patch.

-- 
           Summary: Hang on exit if pthread_key_delete called after
                    pthread_onexit_process
           Product: glibc
           Version: 2.3.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: linuxthreads
        AssignedTo: drow at false dot org
        ReportedBy: ian at airs dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2948

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug linuxthreads/2948] Hang on exit if pthread_key_delete called after pthread_onexit_process
  2006-07-21 16:55 [Bug linuxthreads/2948] New: Hang on exit if pthread_key_delete called after pthread_onexit_process ian at airs dot com
@ 2006-07-21 16:55 ` ian at airs dot com
  2006-07-21 16:56 ` ian at airs dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ian at airs dot com @ 2006-07-21 16:55 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From ian at airs dot com  2006-07-21 16:55 -------
Created an attachment (id=1173)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1173&action=view)
Test case


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2948

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug linuxthreads/2948] Hang on exit if pthread_key_delete called after pthread_onexit_process
  2006-07-21 16:55 [Bug linuxthreads/2948] New: Hang on exit if pthread_key_delete called after pthread_onexit_process ian at airs dot com
  2006-07-21 16:55 ` [Bug linuxthreads/2948] " ian at airs dot com
@ 2006-07-21 16:56 ` ian at airs dot com
  2006-07-21 18:03 ` mec at google dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ian at airs dot com @ 2006-07-21 16:56 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From ian at airs dot com  2006-07-21 16:56 -------
Created an attachment (id=1174)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1174&action=view)
Patch which fixes the problem


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2948

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug linuxthreads/2948] Hang on exit if pthread_key_delete called after pthread_onexit_process
  2006-07-21 16:55 [Bug linuxthreads/2948] New: Hang on exit if pthread_key_delete called after pthread_onexit_process ian at airs dot com
  2006-07-21 16:55 ` [Bug linuxthreads/2948] " ian at airs dot com
  2006-07-21 16:56 ` ian at airs dot com
@ 2006-07-21 18:03 ` mec at google dot com
  2006-07-24 17:27 ` drow at sources dot redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mec at google dot com @ 2006-07-21 18:03 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mec at google dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2948

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug linuxthreads/2948] Hang on exit if pthread_key_delete called after pthread_onexit_process
  2006-07-21 16:55 [Bug linuxthreads/2948] New: Hang on exit if pthread_key_delete called after pthread_onexit_process ian at airs dot com
                   ` (2 preceding siblings ...)
  2006-07-21 18:03 ` mec at google dot com
@ 2006-07-24 17:27 ` drow at sources dot redhat dot com
  2006-07-24 17:27 ` drow at sources dot redhat dot com
  2006-08-15 18:57 ` dank at kegel dot com
  5 siblings, 0 replies; 7+ messages in thread
From: drow at sources dot redhat dot com @ 2006-07-24 17:27 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drow at sources dot redhat dot com  2006-07-24 17:27 -------
Created an attachment (id=1181)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1181&action=view)
Patch that applies to HEAD.

Updated to match a bug fix for a similar case.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2948

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug linuxthreads/2948] Hang on exit if pthread_key_delete called after pthread_onexit_process
  2006-07-21 16:55 [Bug linuxthreads/2948] New: Hang on exit if pthread_key_delete called after pthread_onexit_process ian at airs dot com
                   ` (3 preceding siblings ...)
  2006-07-24 17:27 ` drow at sources dot redhat dot com
@ 2006-07-24 17:27 ` drow at sources dot redhat dot com
  2006-08-15 18:57 ` dank at kegel dot com
  5 siblings, 0 replies; 7+ messages in thread
From: drow at sources dot redhat dot com @ 2006-07-24 17:27 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drow at sources dot redhat dot com  2006-07-24 17:27 -------
Checked in.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=2948

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug linuxthreads/2948] Hang on exit if pthread_key_delete called after pthread_onexit_process
  2006-07-21 16:55 [Bug linuxthreads/2948] New: Hang on exit if pthread_key_delete called after pthread_onexit_process ian at airs dot com
                   ` (4 preceding siblings ...)
  2006-07-24 17:27 ` drow at sources dot redhat dot com
@ 2006-08-15 18:57 ` dank at kegel dot com
  5 siblings, 0 replies; 7+ messages in thread
From: dank at kegel dot com @ 2006-08-15 18:57 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From dank at kegel dot com  2006-08-15 18:57 -------
Here's where he checked it in, I think:
http://sourceware.org/ml/glibc-cvs/2006-q3/msg00032.html

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2948

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-08-15 18:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-21 16:55 [Bug linuxthreads/2948] New: Hang on exit if pthread_key_delete called after pthread_onexit_process ian at airs dot com
2006-07-21 16:55 ` [Bug linuxthreads/2948] " ian at airs dot com
2006-07-21 16:56 ` ian at airs dot com
2006-07-21 18:03 ` mec at google dot com
2006-07-24 17:27 ` drow at sources dot redhat dot com
2006-07-24 17:27 ` drow at sources dot redhat dot com
2006-08-15 18:57 ` dank at kegel dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).