Sourceware Bugzilla – Bug 10879
Rapidly exiting threads cause problems on attach+continue on Solaris
Last modified: 2009-10-31 17:25:21 UTC
This is a logical continuation of PR10757.
/// --- cut ---
/* compile with "gcc -g -pthreads manythreads.c -o manythreads" */
void *foo (void)
// set breakpoint here
void *fn (void *p)
pthread_t tid = (pthread_t) p;
if (p != NULL)
assert (pthread_join (tid, NULL) == 0);
while ((rc = pthread_create (&tid, NULL, fn, (void*) pthread_self ())) != 0)
fprintf (stderr, "unexpected error from pthread_create: %d\n", rc);
int main (int argc, char *argv)
int i, n_threads = 100;
if (argc > 1)
n_threads = atoi (argv);
for (i = 0; i < n_threads; ++i)
while (pthread_create (&tid, NULL, fn, NULL) != 0)
/// --- cut ---
./manythreads & sleep 1 && ./gdb -nx ./manythreads $!
GNU gdb (GDB) 126.96.36.19991031-cvs
Copyright (C) 2009 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-pc-solaris2.10".
For bug reporting instructions, please see:
Reading symbols from /export/home/paul/tmp/manythreads...done.
Attaching to program `/export/home/paul/tmp/manythreads', process 12880
[New process 12880]
Reading symbols from /lib/libpthread.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libpthread.so.1
Reading symbols from /lib/libc.so.1...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New LWP 7656 ]
[New LWP 7614 ]
[New Thread 7459 ]
[New Thread 7458 ]
[New Thread 7457 ]
Loaded symbols for /lib/libc.so.1
Reading symbols from /lib/ld.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/ld.so.1
[Switching to Thread 1 (LWP 1)]
0xfef19735 in ___nanosleep () from /lib/libc.so.1
(gdb) b foo
procfs: fetch_registers, get_gregs line 3800, /proc/12880/lwp/7457: No such file
Another failure I've seen:
(gdb) b foo
Breakpoint 1 at 0x8050ab2: file manythreads.c, line 10.
(gdb) commands 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
[LWP 2236 exited]
[New LWP 2247 ]
[LWP 2235 exited]
[LWP 2246 exited]
sol_thread_fetch_registers: td_ta_map_id2thr: no thread can be found to satisfy
Subject: Re: New: Rapidly exiting threads cause problems on attach+continue on Solaris
On Saturday 31 October 2009 17:25:22, ppluzhnikov at google dot com wrote:
> Another failure I've seen:
> (gdb) b foo
> Breakpoint 1 at 0x8050ab2: file manythreads.c, line 10.
> (gdb) commands 1
> Type commands for when breakpoint 1 is hit, one per line.
> End with a line saying just "end".
> (gdb) c
> [LWP 2236 exited]
> [New LWP 2247 ]
> [LWP 2235 exited]
> [LWP 2246 exited]
> sol_thread_fetch_registers: td_ta_map_id2thr: no thread can be found to satisfy
May be related to PR7860.