From Bugzilla Helper: User-Agent: Mozilla/4.76 [en] (WinNT; U) Description of problem: When using gdb to debug a program that creates a large number of threads, gdb will stop with a message of: "Cannot find thread 33: invalid thread handle" Trying to continue causes a seg fault. How reproducible: Always Steps to Reproduce: 1. Compile the threadbug.c program (below) with: gcc -D_REENTRANT -g -o threadbug threadbug.c -lpthread 2. Start up gdb: gdb threadbug 3. Run the program (gdb) r Actual Results: Program runs, giving output like: Starting program: /home/justin/dlock [New Thread 1024 (LWP 9792)] [New Thread 2049 (LWP 9793)] Delayed SIGSTOP caught for LWP 9793. [New Thread 1026 (LWP 9794)] Delayed SIGSTOP caught for LWP 9794. LWP 9794 exited. ... (cut for brevity) ... [New Thread 31776 (LWP 9824)] Delayed SIGSTOP caught for LWP 9824. LWP 9824 exited. Cannot find thread 33: invalid thread handle Expected Results: Starting program: /home/justin/dlock [New Thread 1024 (LWP 9792)] [New Thread 2049 (LWP 9793)] Delayed SIGSTOP caught for LWP 9793. [New Thread 1026 (LWP 9794)] Delayed SIGSTOP caught for LWP 9794. LWP 9794 exited. ... (cut for brevity) ... [New Thread 31776 (LWP 9824)] Delayed SIGSTOP caught for LWP 9824. LWP 9824 exited. LWP 9793 exited. Program exited normally. (this isn't "real" output, but it gives the idea) Additional info: Running RH7.1 out of the box on an IBM Netfinity x340, IBM NetVista, and others. Problem does not seem to be isolated to any particular hardware. While this qualifies as a "Normal" severity bug, it makes it impossible to debug our product on RH7.1. The only current workaround we know of is to roll back to RH6.2.
Created attachment 17286 [details] Small program to demonstrate thread limit
Confirmed.
A patch can be found at http://sources.redhat.com/ml/gdb-patches/2001-04/msg00240.html
You would need this as well: http://sources.redhat.com/ml/gdb-patches/2001-05/msg00042.html There is some discussion on the gdb-list (found at http://sources.redhat.com/gdb/) of this patch - I'll make new rpms when the dust settles and something is checked into the main CVS.
The version of gdb in CVS (http://sources.redhat.com/gdb/) now works with your test example. It hasn't yet propagated to the daily snapshots - I'll take the one tomorrow and build it.
Fixed in gdb-5.0rh-9, which should show up in Rawhide in the not too distant future and is available now from http://people.redhat.com/teg/gdb/
*** Bug 27311 has been marked as a duplicate of this bug. ***