This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pthread_join problems


Hello,

as previously stated I'm having some issues with a threaded app I'm 
debugging.  In some cases the pthread manager thread seems to segfault 
when pthread_join is called.

I am on redhat 7.3 with glibc 2.2.5.

I also installed the glibc-debug rpm and started gdb with 
LD_LIBRARY_PRELOAD but that gives a very weird back trace starting at -1.

So I searched the archives for any related info and found the following 
mail:

http://sources.redhat.com/ml/libc-alpha/2000-12/msg00100.html

I tried running this test app (with a few modifications for setstack), but 
the pthread manager segfaults for this test app.  Is this test app 
supposed to work ? I attached it to the mail.

Running the test app gives this:

[thomas@thocra test]$ ./pthreadtest 
start 0x8049ff8
start 0x805bff8
start 0x806c010
start 0x807c028

running it in gdb shows this :

(gdb) run
Starting program: /home/thomas/tmp/test/pthreadtest 
[New Thread 1024 (LWP 8316)]
[New Thread 2049 (LWP 8317)]
[New Thread 1026 (LWP 8318)]
[New Thread 2051 (LWP 8319)]
start 0x805bff8
[New Thread 3076 (LWP 8320)]
start 0x806c010
[New Thread 4101 (LWP 8321)]
start 0x807c028

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 2049 (LWP 8317)]
0x400b546d in memset () from /lib/libc.so.6
(gdb) bt
#0  0x400b546d in memset () from /lib/libc.so.6
#1  0x4002a011 in pthread_allocate_stack () from /lib/libpthread.so.0
#2  0x4002a1ad in pthread_handle_create () from /lib/libpthread.so.0
#3  0x40029da0 in __pthread_manager () from /lib/libpthread.so.0
#4  0x4002a7a1 in __pthread_manager_event () from /lib/libpthread.so.0
(gdb) info threads
  6 Thread 4101 (LWP 8321)  0x40109634 in write () from /lib/libc.so.6
  5 Thread 3076 (LWP 8320)  0x401102de in select () from /lib/libc.so.6
  4 Thread 2051 (LWP 8319)  0x401102de in select () from /lib/libc.so.6
  3 Thread 1026 (LWP 8318)  0x40062036 in sigsuspend () from 
/lib/libc.so.6
* 2 Thread 2049 (LWP 8317)  0x400b546d in memset () from /lib/libc.so.6
  1 Thread 1024 (LWP 8316)  0x40062036 in sigsuspend () from 
/lib/libc.so.6
(gdb) 


Running it with the debug libraries gives this:

[thomas@thocra test]$ LD_LIBRARY_PATH=/usr/lib/debug gdb ./pthreadtest
GNU gdb Red Hat Linux (5.1.90CVS-5)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you 
are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for 
details.
This GDB was configured as "i386-redhat-linux"...
(gdb) run
Starting program: /home/thomas/tmp/test/pthreadtest 
[New Thread 1024 (LWP 8323)]
[New Thread 2049 (LWP 8324)]
[New Thread 1026 (LWP 8325)]
start 0x8049ff8
[New Thread 2051 (LWP 8326)]
start 0x805bff8
[New Thread 3076 (LWP 8327)]
start 0x806c010
[New Thread 4101 (LWP 8328)]
start 0x807c028

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 2049 (LWP 8324)]
0x400a446d in memset (dstpp=0x80abc40, c=0, len=1024)
    at ../sysdeps/i386/memset.c:65
65	../sysdeps/i386/memset.c: No such file or directory.
	in ../sysdeps/i386/memset.c
(gdb) bt
#0  0x400a446d in memset (dstpp=0x80abc40, c=0, len=1024)
    at ../sysdeps/i386/memset.c:65
#1  0x40019011 in pthread_allocate_stack (attr=0xbffff450, 
    default_new_thread=0xbefffc00, pagesize=4096, 
out_new_thread=0x805be38, 
    out_new_thread_bottom=0x805be3c, out_guardaddr=0x805be40, 
    out_guardsize=0x805be44) at manager.c:396
#2  0x400191ad in pthread_handle_create (thread=0x40025110, 
attr=0xbffff450, 
    start_routine=0x8048840 <t_entry>, arg=0xbffff4b0, mask=0x805bea0, 
    father_pid=8323, report_events=1, event_maskp=0x4002526c) at 
manager.c:622
#3  0x40018da0 in __pthread_manager (arg=0x400254a0) at manager.c:188
#4  0x400197a1 in __pthread_manager_event () at manager.c:258
(gdb) 


I am unsure if this test app is supposed to work at all, and if it is, why 
it might be failing (the mesmet seems valid to me) and how I can further 
debug it.

Thanks,
Thomas

 -- 

The Dave/Dina Project : future TV today ! - http://davedina.apestaart.org/
<-*-                      -*->
If you go
go for good
don't fucking joke
you know I would
<-*- thomas@apestaart.org -*->
URGent, the best radio on the Internet - 24/7 ! - http://urgent.rug.ac.be/

Attachment: pthreadtest.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]