From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH 0/5] GNU/Linux, fix attach races/problems
Date: Fri, 09 Jan 2015 12:03:00 -0000 [thread overview]
Message-ID: <54AFC388.7050706@redhat.com> (raw)
In-Reply-To: <1418748834-27545-1-git-send-email-palves@redhat.com>
On 12/16/2014 04:53 PM, Pedro Alves wrote:
> Investigating an "attach" bug seemingly caused by a race, related to
> the fact that on Linux we have to attach to each thread individually,
> I decided to write a test that stresses that aspect of attach. The
> test constantly spawns short-lived threads, and has GDB attach, debug
> a little, detach, attach, rinse/repeat a few times.
>
> That actually exposed a set of issues, both in GDB and in
> glibc/libthread_db.
>
> One is that the test defeats the current heuristics in place: we still
> fail to attach to some threads sometimes, if the program spawns them
> quickly enough. This is fixed by fetching the list of LWPs to attach
> to from /proc instead of relying on libthread_db for that.
>
> Another is that some times we'd try to attach to a bogus lwp with
> PID==-1, and do a dangerous waitpid, potentially eating an event by
> mistake and breaking the debug session as result.
>
> Yet another is a nasty libthread_db event reporting mechanism race
> related to detaching from the inferior just while a thread is
> reporting an event, resulting in a subsequent attach session tripping
> on broken libthread_db events. We work around this by no longer using
> libthread_db for thread event creation/death reporting, which is good
> on its own, for being much more robust and efficient.
>
> I've filed a couple glibc bugs as result of all this:
>
> Bug 17705 - nptl_db: stale thread create/death events if debugger detaches
> https://sourceware.org/bugzilla/show_bug.cgi?id=17705
>
> Bug 17707 - nptl_db: terminated and joined threads
> https://sourceware.org/bugzilla/show_bug.cgi?id=17707
>
> The series fixes the GDB issues and at the same time works around the
> glibc issues.
>
> Tested on x86_64 Fedora 20, native and gdbserver.
>
> Comments?
I've pushed this in now.
Thanks,
Pedro Alves
prev parent reply other threads:[~2015-01-09 12:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 16:54 Pedro Alves
2014-12-16 16:54 ` [PATCH 4/5] Linux: Skip thread_db thread event reporting if PTRACE_EVENT_CLONE is supported Pedro Alves
2014-12-16 21:24 ` Simon Marchi
2014-12-17 13:04 ` Pedro Alves
2014-12-16 16:54 ` [PATCH 3/5] libthread_db: Skip attaching to terminated and joined threads Pedro Alves
2014-12-16 16:54 ` [PATCH 1/5] libthread_db: debug output should go to gdb_stdlog Pedro Alves
2014-12-17 8:02 ` Yao Qi
2014-12-17 13:45 ` Pedro Alves
2014-12-17 14:09 ` Yao Qi
2014-12-16 16:54 ` [PATCH 2/5] Linux: on attach, attach to lwps listed under /proc/$pid/task/ Pedro Alves
2014-12-16 20:52 ` Simon Marchi
2014-12-17 13:35 ` Pedro Alves
2014-12-16 17:35 ` [PATCH 5/5] Test attaching to a program that constantly spawns short-lived threads Pedro Alves
2014-12-17 11:10 ` Yao Qi
2014-12-18 0:02 ` Pedro Alves
2015-01-05 19:02 ` Breazeal, Don
2015-01-07 16:17 ` [PATCH] skip "attach" tests when testing against stub-like targets (was: Re: [PATCH 5/5] Test attaching to a program that constantly spawns short-lived threads) Pedro Alves
2015-01-09 11:24 ` [PATCH] skip "attach" tests when testing against stub-like targets Pedro Alves
2015-01-12 4:43 ` [regression/native-gdbserver][buildbot] Python testscases get staled (was: Re: [PATCH] skip "attach" tests when testing against stub-like targets) Sergio Durigan Junior
2015-01-12 11:15 ` [regression/native-gdbserver][buildbot] Python testscases get staled Pedro Alves
2015-01-12 16:55 ` Sergio Durigan Junior
2015-01-12 17:01 ` Pedro Alves
2015-01-12 17:13 ` [PATCH] gdb.python/py-prompt.exp: restore GDBFLAGS Pedro Alves
2015-01-09 12:03 ` Pedro Alves [this message]
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=54AFC388.7050706@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox