[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201108191128.09930.pedro@codesourcery.com>
Date: Fri, 19 Aug 2011 11:28:09 +0100
From: Pedro Alves <pedro@...esourcery.com>
To: Lin Ming <ming.m.lin@...el.com>
Cc: Philipp Marek <philipp.marek@...bit.com>,
Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: Hanging threads with pthread_detach and gdb
On Friday 19 August 2011 09:54:43, Lin Ming wrote:
> =====
> gdb wait for pid=2431
> gdb is going to sleep ...
> gdb children list:
> pid=2431, exit_state=16, exit_signal=17
> gdb ptrace list:
> pid=2436, exit_state=16, exit_signal=-1
> pid=2431, exit_state=16, exit_signal=17
> =====
>
> exit_state 16 is EXIT_ZOMBIE state.
> pid 2431 is the thread group leader.
> pid 2436 is the thread group member(other members have been removed).
>
> gdb is waiting the group leader, but it fails because the group is not
> empty. Then gdb goes to sleep.
>
> At this moment, all threads have gone into EXIT_ZOMBIE state.
> So no thread can wake up gdb anymore.
>
> That's why gdb hangs.
>
> I'm not familiar with pthread semantics.
> Is this a problem need to be fixed?
>
Yeah, it's an ugly ptrace quirk. waitpid'ing the exited
tg leader hangs if there are other threads in the group,
even if they're zombies.
I believe this is fixed / worked around mainline GDB:
http://sourceware.org/bugzilla/show_bug.cgi?id=10970
http://sourceware.org/bugzilla/show_bug.cgi?id=12702
http://sourceware.org/ml/gdb-patches/2011-05/msg00401.html
Though it'd be nice not to need the workaround...
--
Pedro Alves
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists