"Cannot find new threads" on Fedora 9, but not on CentOS 5 (?)

Andrew Lofthouse loftyhauser@gmail.com
Thu Oct 30 01:11:00 GMT 2008


Paul Pluzhnikov wrote:

  > The application apparently dynamically loads /tmp/gfsZ54KNU,
> which in turn depends (perhaps indirectly) on libpthread.so.0
> 
> This is supposed to work in theory, but apparently has glitches on
> Fedora 9, though I can't reproduce that on my x86_64 Fedora 9.
> 
> See what you get with a test case at the bottom.
> 
> As a workaround, you may try to build your ufs2oogl2D with '-pthread'.

This indeed works ("./configure LIBS=-pthread"):

[andrew@fedora-vm ufs]$ gdb /usr/local/bin/ufs2oogl2D
GNU gdb Fedora (6.8-1.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) run -T "rho" < UAM10_002_UFS-005000.sim > test.plt
Starting program: /usr/local/bin/ufs2oogl2D -T "rho" < 
UAM10_002_UFS-005000.sim > test.plt
[Thread debugging using libthread_db enabled]

Detaching after fork from child process 16872.
[New Thread 0xb7f7c710 (LWP 16869)]

Detaching after fork from child process 16883.
Detaching after fork from child process 16894.
Detaching after fork from child process 16905.
Detaching after fork from child process 16916.
Detaching after fork from child process 16927.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7f7c710 (LWP 16869)]
0x00137d17 in symmetry_gasdynamics (f=0xbff90c30, b=0x9683570)
     at boundary_gasdynamics.c:282
282	  n = floor((b->v->i - ufs->rho[0]->i)/7.);
Missing separate debuginfos, use: debuginfo-install glib2.i386 
glibc.i686 libselinux.i386

> Anyway, do you get any problems with the test case below.

Not exactly the same output as yours in the backtrace (due to 
differences between i386 and x86-64?), but no apparent problems:

[andrew@fedora-vm ufs]$ gdb ./a.out
GNU gdb Fedora (6.8-1.fc9)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(no debugging symbols found)
(gdb) run
Starting program: /home/andrew/ufs/a.out
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0xb80e56c0 (LWP 16859)]
[New Thread 0xb80e4b90 (LWP 16862)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb80e4b90 (LWP 16862)]
0x0011147b in fn (p=0x0) at thread-so.c:8
8	   cp[0] = 'a';
Missing separate debuginfos, use: debuginfo-install glib2.i386 
glibc.i686 libselinux.i386
(gdb) info thread
* 2 Thread 0xb80e4b90 (LWP 16862)  0x0011147b in fn (p=0x0) at thread-so.c:8
   1 Thread 0xb80e56c0 (LWP 16859)  0x00110416 in __kernel_vsyscall ()
(gdb) bt
#0  0x0011147b in fn (p=0x0) at thread-so.c:8
#1  0x008bc32f in start_thread () from /lib/libpthread.so.0
#2  0x007d927e in clone () from /lib/libc.so.6
(gdb) thread 1
[Switching to thread 1 (Thread 0xb80e56c0 (LWP 16859))]#0  0x00110416 in 
__kernel_vsyscall ()
(gdb) bt
#0  0x00110416 in __kernel_vsyscall ()
#1  0x008c2916 in __lll_unlock_wake_private () from /lib/libpthread.so.0
#2  0x008bc7d4 in _L_unlock_2792 () from /lib/libpthread.so.0
#3  0x008bbbd6 in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0
#4  0x008bc0f8 in pthread_create@GLIBC_2.0 () from /lib/libpthread.so.0
#5  0x001114ba in foo () at thread-so.c:15
#6  0x08048497 in main ()

> What does "info threads" at crash point say?

Nothing seemingly useful:

(gdb) info threads
* 1 Thread 0xb7f7c710 (LWP 16869)  0x00137d17 in symmetry_gasdynamics (
     f=0xbff90c30, b=0x9683570) at boundary_gasdynamics.c:282


It seems to me that there is some difference in the linking of shared 
libraries between Fedora 9 and CentOS 5.  With the same exact code and 
the same exact configure, make sequence, CentOS 5 ldd shows libpthread 
(without explicitly specifying it, i.e. LIBS=-pthread), while on Fedora, 
there is no explicit link.  Thus, gdb doesn't handle it on Fedora 9.  I 
wonder what is different? And, yet, it handles your test case as well...

Even if we don't come to the final answer, at least I can work around 
the problem--thanks!

Regards,

Andrew



More information about the Gdb mailing list