From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EC9DE3858C36; Thu, 29 Feb 2024 20:29:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC9DE3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709238572; bh=Dax6DdYNpYjsA5QtnCV9f3N+zDM450VkW6KfTBsYEGY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wsNcBTAl3YGMSOLFIIWfxziWt+IqZrWDmGkOP45RKJ2NB0SM6OUHi6eGIdD0xoYMk lgPNKPNk+3wq2lXebNHtdIvW/m+aXvpr4LVxfIL3ToeyaX9xVIOAc2hjoZbLRC0/aQ yY65Qn6TusitX5sgUicZpZaYfQiM5fZxtEOTf/xo= From: "cvs-commit at gcc dot gnu.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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: dap X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: tromey at sourceware dot org X-Bugzilla-Target-Milestone: 15.1 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31275 --- Comment #8 from Sourceware Commits --- The master branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D032d23a6db09= 7840b7969867df0e2ba035f03f6f commit 032d23a6db097840b7969867df0e2ba035f03f6f Author: Tom de Vries 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 =3D 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 =3D=3D self.in_flight_gdb_thread. This makes the test-case pass 100/100, also when adding the extra stres= sor of "taskset -c 0", which makes the fail more likely without the patch. Tested on aarch64-linux. Approved-By: Tom Tromey PR dap/31275 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31275 --=20 You are receiving this mail because: You are on the CC list for the bug.=