bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pthreads, linux, gdb, oh my!


From: Mark Kettenis
Subject: Re: Pthreads, linux, gdb, oh my!
Date: 08 Dec 2000 17:20:24 +0100

Peter Berger <address@hidden> writes:

> Hi.  I have the following tiny test program which fails dramatically in a
> number of fascinating ways on various version of linux, using various
> versions of glibc, under various (current) versions of GDB.  I am honestly
> not sure if this is a linux bug, a glibc bug, or a gdb bug, but:
> 
> - it runs OK outside of gdb, so I suspect it's not a kernel bug, and

Wrong!

> - it runs OK with the same version of gdb on FreeBSD.

GDB is able to handle threads on FreeBSD?

> So I am sending the test code here; can -anyone- get this to run
> correctly, on any version of linux, under gdb?

Probably not :-(.

> All the program does is create a thread, wait for that thread to exit,
> then iterate and do it again, and again, until MAX_COUNT_SEQ_THREADS is
> reached.  So no more than 2 threads should be running at once.  
> 
> I have seen two failure modes:  on my machine (linux 2.2.5-22, glibc
> 2.1.1), when run under gdb, the created pthreads stick around as zombies
> until the machine runs out of resources.  On some friends' machines
> (kernel 2.2.15, glibc 2.1.94), the program creates one pthread, waits for
> it to exit, and then exits.

The zombie problem is a kernel bug.  AFAIK there is no kernel that
doesn't have this bug.  Unfortunately getting the bugfix in isn't very
easy.  I'll try poking Linus again when I can find the time.

You're not telling us what version of GDB you've been using.  There is
HJ's GDB 4.17-for-linux out there that handles threads in a usable
fashion, but that version has some limitations and I'm not sure if it
works with recent glibc versions.  GDB 5.0 exhibits problems like
you're describing with your friend's machine.  This should be fixed in
the current GDB development version (in CVS or a recent snapshot) but
that version of GDB will get into trouble after you've created
30-something threads.

Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]