From: Pedro Alves <pedro@codesourcery.com>
To: Lin Ming <ming.m.lin@intel.com>
Cc: Philipp Marek <philipp.marek@linbit.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: Hanging threads with pthread_detach and gdb
Date: Fri, 19 Aug 2011 11:28:09 +0100 [thread overview]
Message-ID: <201108191128.09930.pedro@codesourcery.com> (raw)
In-Reply-To: <1313744083.4115.206.camel@minggr.sh.intel.com>
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
next prev parent reply other threads:[~2011-08-19 10:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-16 12:58 Hanging threads with pthread_detach and gdb Philipp Marek
[not found] ` <CAF1ivSZ-CCzFUH4WtxqL2QBoyB3WtF+KMqnCBdjaHhZ7-bbVjA@mail.gmail.com>
2011-08-19 8:54 ` Lin Ming
2011-08-19 10:28 ` Pedro Alves [this message]
2011-08-19 12:08 ` Lin Ming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201108191128.09930.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=philipp.marek@linbit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.