public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug dap/31275] [gdb/dap, gdb.dap/pause.exp] ERROR: timeout reading json header
Date: Thu, 29 Feb 2024 20:29:27 +0000	[thread overview]
Message-ID: <bug-31275-4717-S7m6Erep7w@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31275-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=31275

--- Comment #8 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=032d23a6db097840b7969867df0e2ba035f03f6f

commit 032d23a6db097840b7969867df0e2ba035f03f6f
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Feb 29 21:29:34 2024 +0100

    [gdb/dap] Fix stray KeyboardInterrupt after cancel

    When running test-case gdb.dap/pause.exp 100 times in a loop, it passes
    100/100.

    But if we remove the two "sleep 0.2" from the test-case, we run into
    (copied from dap.log and edited for readability):
    ...
    Traceback (most recent call last):
      File "startup.py", line 251, in message
        def message():

    KeyboardInterrupt
    Quit
    ...

    This happens as follows.

    CancellationHandler.cancel calls gdb.interrupt to cancel a request in
flight.

    The idea is that this interrupt triggers while in fn here in message (a
nested
    function of send_gdb_with_response):
    ...
        def message():
            try:
                val = fn()
                result_q.put(val)
            except (Exception, KeyboardInterrupt) as e:
                result_q.put(e)
    ...
    but instead it triggers outside the try/except.

    Fix this by:
    - in CancellationHandler, renaming variable in_flight to
in_flight_dap_thread,
      and adding a variable in_flight_gdb_thread to be able to distinguish when
      a request is in flight in the dap thread or the gdb thread.
    - adding a wrapper Cancellable to to deal with cancelling the wrapped
      event
    - using Cancellable in send_gdb and send_gdb_with_response to wrap the
posted
      event
    - in CancellationHandler.cancel, only call gdb.interrupt if
      req == self.in_flight_gdb_thread.

    This makes the test-case pass 100/100, also when adding the extra stressor
of
    "taskset -c 0", which makes the fail more likely without the patch.

    Tested on aarch64-linux.

    Approved-By: Tom Tromey <tom@tromey.com>

    PR dap/31275
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31275

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-02-29 20:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 19:05 [Bug dap/31275] New: " vries at gcc dot gnu.org
2024-01-22 19:07 ` [Bug dap/31275] " vries at gcc dot gnu.org
2024-01-22 20:32 ` tromey at sourceware dot org
2024-01-23 11:55 ` vries at gcc dot gnu.org
2024-01-23 16:42 ` tromey at sourceware dot org
2024-02-08 16:06 ` vries at gcc dot gnu.org
2024-02-08 17:00 ` vries at gcc dot gnu.org
2024-02-12 18:59 ` tromey at sourceware dot org
2024-02-19 15:21 ` vries at gcc dot gnu.org
2024-02-23 16:52 ` vries at gcc dot gnu.org
2024-02-29 20:29 ` cvs-commit at gcc dot gnu.org [this message]
2024-02-29 20:30 ` vries at gcc dot gnu.org

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=bug-31275-4717-S7m6Erep7w@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).