public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC 1/3] [gdb/dap] Fix exit race
Date: Wed, 14 Feb 2024 18:16:04 +0100	[thread overview]
Message-ID: <bb268a8a-293a-47f2-992c-b8ebc86b2787@suse.de> (raw)
In-Reply-To: <87jzn73tpv.fsf@tromey.com>

On 2/14/24 17:18, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
>>> Ok.  FWIW I think the Queue idea seems totally fine, and combining
>>> these
>>> patches seems natural to me.
> 
> Tom> Sorry for going on this topic, but I'd like to understand why you
> Tom> think this.
> 
> My thinking is that the code is written this way to solve the flushing
> issue (perhaps not well).  Removing the quit fixes one issue, but it
> risks introducing another.  I'm not really a stickler for this though.

Thanks for the explanation.

OK, I think I start to understand your position.  You've written both 
pieces of code with the intent to address one problem, which is why 
you're thinking about it as a whole.

I haven't added the code, I'm just looking at the behaviour of two 
different races and am seeing two independent problems.

[ FWIW, I understood the send_gdb("quit") as a means to ensure that 
gdb's main thread doesn't keep hanging after the dap threads have 
exited, which AFAICT is a problem unrelated to the flushing race. ]

To follow up on the risk remark, I'm not sure which risk you're 
referring to.

I've documented one risk in the commit log:
...
     So, for the system I'm running this on, the send_gdb("quit") is
     actually not needed.

     I'm not sure if we support any systems where it's actually needed.
...
There's a risk that indeed there are such systems, but I figured we can 
deal with that when we encounter them.

If you mean the risk of not flushing in time, I don't think there's any 
relation with send_gdb("quit").  The problem with not flushing in time 
is there, and AFAIU the problem is not made any better or worse by 
removing the send_gdb("quit").

I'll proceed to commit the approved patch, since I'm keen on getting rid 
of the segfault.

As for the flushing race, as I've documented in the PR, the queue 
approach doesn't completely fix the race.  I wonder if using a 
gdb_exiting hook to wait for the maint dap thread to exit is the way to 
go there.

Thanks,
- Tom


  reply	other threads:[~2024-02-14 17:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07  9:02 [RFC 0/3] [gdb/dap] Fix issues triggered by gdb.dap/eof.exp Tom de Vries
2024-02-07  9:02 ` [RFC 1/3] [gdb/dap] Fix exit race Tom de Vries
2024-02-07 16:01   ` Tom Tromey
2024-02-13 15:04     ` Tom de Vries
2024-02-13 18:04       ` Tom Tromey
2024-02-13 18:11         ` Tom Tromey
2024-02-14 15:31         ` Tom de Vries
2024-02-14 15:34           ` Tom Tromey
2024-02-14 15:53             ` Tom de Vries
2024-02-14 16:18               ` Tom Tromey
2024-02-14 17:16                 ` Tom de Vries [this message]
2024-02-07  9:02 ` [RFC 2/3] [gdb/dap] Catch and log exceptions in dap threads Tom de Vries
2024-02-07 15:52   ` Tom Tromey
2024-02-12 15:15     ` Tom de Vries
2024-02-12 17:35       ` Tom Tromey
2024-02-07  9:02 ` [RFC 3/3] [gdb/dap] Ignore OSError on stream.flush in JSON writer Tom de Vries
2024-02-07 10:29   ` Tom de Vries

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=bb268a8a-293a-47f2-992c-b8ebc86b2787@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).