From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Pedro Alves <palves@redhat.com>
Cc: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: Fix instability in thread groups test
Date: Mon, 13 Aug 2018 13:01:00 -0000 [thread overview]
Message-ID: <20180813130125.GY3155@embecosm.com> (raw)
In-Reply-To: <2e47657d-b81b-497d-58bf-0463980dec24@redhat.com>
* Pedro Alves <palves@redhat.com> [2018-08-13 13:03:47 +0100]:
> On 08/13/2018 12:41 PM, Andrew Burgess wrote:
> > * Pedro Alves <palves@redhat.com> [2018-08-13 10:51:44 +0100]:
> >
> >> But shouldn't we make GDB handle this better? Make the output
> >> more "atomic" in the sense that we either show a valid complete
> >> entry, or no entry? There's an inherent race
> >> here, since we use multiple /proc accesses to fill up a process
> >> entry. If we start fetching process info for a process, and the process
> >> disappears midway, I'd think it better to discard that process's entry,
> >> as-if we had not even seen it, i.e., as if we had listed the set of
> >> processes a tiny moment later.
> >
> > I agree.
> >
> > We also need to think about process reuse. So with multiple accesses
> > to /proc we might start with one process, and end up with a completely
> > new process.
> >
> > I might be overthinking it, but my first guess at a reliable strategy
> > would be:
> >
> > 1. Find each /proc/PID directory.
> > 2. Read /proc/PID/stat and extract the start time. Failure to read
> > this causes the process to be abandoned.
> > 3. Read all of the other /proc/PID/XXX files as needed. Any failure
> > results in the process being abandoned.
> > 4. Reread /proc/PID/stat and confirm the start time hasn't changed,
> > this would indicate a new process having slipped in.
> >
>
> My initial quick thought was just to drop the process entry if
> it turns out we end up with an empty core set.
>
> I wonder whether we can prevent PID reuse by keeping a descriptor
> for /proc/PID/ open while we open the other files. Probably not.
That was my first though, I tried:
- chdir /proc/PID
- opendir for /proc/PID
- Kill /proc/PID
- Read from the opendir handle, find nothing there.
Which didn't really surprise me, but was worth a try...
> Otherwise, your scheme sounds like the next best.
>
> > Given the system is still running, we can never be sure that we have
> > "all" processes, so throwing out anything that looks wrong seems like
> > the right strategy.
> >
> > Also in step #4 we know we've just missed a process - something new
> > has started, but we ignore it. I think this is fine though given the
> > racy nature of this sort of thing...
> >
> > The only question is, could these thoughts be dropped into a bug
> > report,
>
>
> Sure.
>
>
> > and the original patch to remove the unstable result applied?
> > Or maybe the test updated to either PASS or KFAIL?
>
> I'd prefer the KFAIL option. At the very least, a comment in
> the .exp file.
I'll put something together...
Thanks,
Andrew
next prev parent reply other threads:[~2018-08-13 13:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-10 9:58 Andrew Burgess
2018-08-10 21:26 ` Simon Marchi
2018-08-13 9:51 ` Pedro Alves
2018-08-13 11:41 ` Andrew Burgess
2018-08-13 12:03 ` Pedro Alves
2018-08-13 13:01 ` Andrew Burgess [this message]
2018-08-13 13:38 ` Pedro Alves
2018-08-13 21:45 ` [PATCHv2] " Andrew Burgess
2018-08-14 11:37 ` Pedro Alves
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=20180813130125.GY3155@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=simon.marchi@polymtl.ca \
/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