From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 12D31385801F for ; Wed, 14 Feb 2024 15:31:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12D31385801F 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 12D31385801F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707924700; cv=none; b=v7EfjI1MaQf7aRSbweh7RLGw4SrEd94DfE2z28QqZf0bCJpF2L8C+ksMLM6nRq0ZJc5meD/HYJIA4pBdW2jJ3VKJYGhbn9VXUsJJ6mcdbZKqTIFn/v4+Ivp7S7QVcYNLhHEwSLebzIMs3mJpGBimDDtMTd9w/WZSQfypcJX5xBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707924700; c=relaxed/simple; bh=Y6NWaCSnExdHvijzVEF9CK4M/Q2w+MRPkRQa7AAtnl4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=hLewlgj/KsKtGG2qGRblWHPsqw6HLegfW8ZmnJmk0sDTNgrskP2gVrGpeAYhQjTa2i5AeM57I3zElxzBuIh7TsvkJgC+upGDWMjoKUsSwWo8Fv4R0COzTD5DWWH3cDcr4RfN5NakV3DmeU2t2eh5bKSKtkDhMfgASL5WYgx14eQ= 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-out1.suse.de (Postfix) with ESMTPS id B675F21ACF; Wed, 14 Feb 2024 15:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707924697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iBYcpEB4nq2HXDqHBD1VeLverXbQxIAeEtJ/aN11kKs=; b=RFzQw8+9vhawy4bY0/+B/lyz4g+zhLFwD0kw/4G9GNeh/QXF5mNssLh4Nnv0e58URsxnqH BlOvhbxN8ukRvI65KcMOKTk4aHk1+lnRBSUDWB6V44EhejQWveVYf0R5Dpwtd2DdAI5ntg fLFqsI6rSa2VU/rws90YdTfjRz8TjCE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707924697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iBYcpEB4nq2HXDqHBD1VeLverXbQxIAeEtJ/aN11kKs=; b=hAG5mqJFXE2FOdeQr/kCAUAfJCv+kMRElqti4B/QSFbiOPcZ1bN2SVXBRbVm1Omd1jaN3Q gNyt6O/IzfdNBvAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707924697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iBYcpEB4nq2HXDqHBD1VeLverXbQxIAeEtJ/aN11kKs=; b=RFzQw8+9vhawy4bY0/+B/lyz4g+zhLFwD0kw/4G9GNeh/QXF5mNssLh4Nnv0e58URsxnqH BlOvhbxN8ukRvI65KcMOKTk4aHk1+lnRBSUDWB6V44EhejQWveVYf0R5Dpwtd2DdAI5ntg fLFqsI6rSa2VU/rws90YdTfjRz8TjCE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707924697; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iBYcpEB4nq2HXDqHBD1VeLverXbQxIAeEtJ/aN11kKs=; b=hAG5mqJFXE2FOdeQr/kCAUAfJCv+kMRElqti4B/QSFbiOPcZ1bN2SVXBRbVm1Omd1jaN3Q gNyt6O/IzfdNBvAw== 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 9E79813A6D; Wed, 14 Feb 2024 15:31:37 +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 TXlBJdnczGUvKAAAD6G6ig (envelope-from ); Wed, 14 Feb 2024 15:31:37 +0000 Message-ID: <8ac3e1d0-7a93-44f0-9568-49d01fe58f9f@suse.de> Date: Wed, 14 Feb 2024 16:31:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC 1/3] [gdb/dap] Fix exit race Content-Language: en-US To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20240207090224.27521-1-tdevries@suse.de> <20240207090224.27521-2-tdevries@suse.de> <875xz0clgw.fsf@tromey.com> <0abb6b1d-52ce-43c5-ac49-fa98ad06a810@suse.de> <87il2s5jho.fsf@tromey.com> From: Tom de Vries In-Reply-To: <87il2s5jho.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-0.62 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BAYES_HAM(-0.53)[80.46%]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Level: X-Spam-Score: -0.62 X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: On 2/13/24 19:04, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries writes: > >>> One way to fix this would be to have start_json_writer return the >>> thread >>> object, and then have main_loop join the thread to terminate after >>> writing the None. This would mean making this particular thread >>> non-daemon though. > > Tom> And as I understand it, the downside of that is that it could possibly > Tom> hang the gdb process. > > How so? > I don't have a concrete worry if that is what you mean. I'm just trying to reverse-engineer the decision making the dap threads daemon, and this is what I could come up with. I hope this answers your question. > Tom> + queue.task_done() > > I think SimpleQueue doesn't have task_done, so you have to change this > code to use Queue and instead. > Ack, understood. Anyway, I've now filed a separate PR for this issue, which I hope makes the discussion a bit clearer, so we have: - a PR for the assertion failure (PR31306) - a PR for ensuring responses are flushed to client before exiting (PR31380) > Tom> # JSON-writing thread, so that we can ensure that all > Tom> # responses are flushed to the client before exiting. > Tom> self.write_queue.put(None) > Tom> + self.write_queue.join() > Tom> + send_gdb("quit") > > I suspect this isn't needed. I assume you specifically mean the last line. Removing that line is the proposed fix for PR31306, the patch quoted above is for PR31380, which we somehow ended up discussing in this thread on PR31306. Thanks, - Tom