From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id BD02F3858C53 for ; Wed, 7 Feb 2024 09:02:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD02F3858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BD02F3858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707296551; cv=none; b=jqYIXDTpXRAGDxTWRYwVvL7+BF/iff/BMzj5jTKr4WgxVFTZeY7ZC7itThoT0gJjYP2vkOAOtw86CQszhRfippIiIodJ2TU95dYsrw+HDP6DCY+byRV8kP/H9ABdKhKjMQPURu4NvRBwIWN9XjKBuuegrWyd44Q/ifeKDtS8z3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707296551; c=relaxed/simple; bh=HSM0iSig++qEoG5R41znUD3BrHdOFpKbevS7HnuAHc0=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=iRnxr+WbQvp/++wbJPu1S234M+hOOMG88uR8XHTO0a8H2U6ax4k+a2zA60pQoX7OIgzYKnthlHnurAoGT9BplRvMcMB+aG9PBrXiQ/fM1rVCGMZNIg1DZe/KJSpDa1jAOY+hh0a24ncMiVSkyPSpe4u0Tc6CanvqffIcqJNaZo0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DC7E11FBBE for ; Wed, 7 Feb 2024 09:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707296548; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1VDmpwAVg9eN8ZK+ecwPqMauiRYEbeATEd+cBsWC9Ac=; b=q+DLierPkg5HIXVm19Tlj/lbviXGsEG8vR8MJRxadrbiuIBBv0/LsczkZ3vY/QSJT80jOB 5eEFfDFr7QYz0wfPa8IbW0iJ3uYPXMr/DJvQRYK0zrzwgCRXn0nJzl8g4cxlBqWXQRjbXP VUZabPAzFduY7KzPvlLBzI68JkUPAko= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707296548; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1VDmpwAVg9eN8ZK+ecwPqMauiRYEbeATEd+cBsWC9Ac=; b=jpbWcjthuhLHHb0oPdFUSKnbsQWh+qgpXqUqidgvk7qk3cKrZ4jrfjLzJb9F5tnFdp6Ipi aL14uZpQMhn2GyDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707296548; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1VDmpwAVg9eN8ZK+ecwPqMauiRYEbeATEd+cBsWC9Ac=; b=q+DLierPkg5HIXVm19Tlj/lbviXGsEG8vR8MJRxadrbiuIBBv0/LsczkZ3vY/QSJT80jOB 5eEFfDFr7QYz0wfPa8IbW0iJ3uYPXMr/DJvQRYK0zrzwgCRXn0nJzl8g4cxlBqWXQRjbXP VUZabPAzFduY7KzPvlLBzI68JkUPAko= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707296548; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1VDmpwAVg9eN8ZK+ecwPqMauiRYEbeATEd+cBsWC9Ac=; b=jpbWcjthuhLHHb0oPdFUSKnbsQWh+qgpXqUqidgvk7qk3cKrZ4jrfjLzJb9F5tnFdp6Ipi aL14uZpQMhn2GyDw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C51D813A43 for ; Wed, 7 Feb 2024 09:02:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EGjqLiRHw2XMSAAAD6G6ig (envelope-from ) for ; Wed, 07 Feb 2024 09:02:28 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [RFC 3/3] [gdb/dap] Ignore OSError on stream.flush in JSON writer Date: Wed, 7 Feb 2024 10:02:24 +0100 Message-Id: <20240207090224.27521-4-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240207090224.27521-1-tdevries@suse.de> References: <20240207090224.27521-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: 2.44 X-Spamd-Result: default: False [2.44 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-1.26)[89.75%] X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Due to the previous two fixes, I can now run test-case gdb.dap/eof.exp without coredumps happening. However, I do run into: ... FAIL: gdb.dap/eof.exp: exceptions in log file ... due to: ... JSON writer: caught exception: err=OSError(5, 'Input/output error'), type(err)= Traceback (most recent call last): File "python/gdb/dap/startup.py", line 72, in thread_wrapper target(*args) File "python/gdb/dap/io.py", line 80, in _json_writer stream.flush() OSError: [Errno 5] Input/output error ... I can image that the stream.flush would throw an OSError if it races with the gdb main thread handling a SIGHUP and finalizing python in the process. Handle this is in the simplest way I can think of: ignore the OSError, and terminate the DAP thread. Tested on aarch64-linux. --- gdb/python/lib/gdb/dap/io.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/python/lib/gdb/dap/io.py b/gdb/python/lib/gdb/dap/io.py index 4edd504c727..e5547bd1072 100644 --- a/gdb/python/lib/gdb/dap/io.py +++ b/gdb/python/lib/gdb/dap/io.py @@ -77,6 +77,9 @@ def start_json_writer(stream, queue): header_bytes = header.encode("ASCII") stream.write(header_bytes) stream.write(body_bytes) - stream.flush() + try: + stream.flush() + except OSError: + break start_thread("JSON writer", _json_writer) -- 2.35.3