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 6EE38385E83F for ; Wed, 14 Feb 2024 17:15:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6EE38385E83F 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 6EE38385E83F 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=1707930952; cv=none; b=E2jm0bp0yKFczz9V8paJUXq02gTfS63klHzbYhOBDx+bydSBjGCs6jDHkfcgvg1ahGuxCZ3C2cy30v1RXTrukX5aETS5PEXoSkj9dSqdEmPvNHoAYMBqfcDFLAx+NCVmduRYlHBugQ6yu01foIsgGk7ZRsiUaEo/yLIaxx9ZLWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707930952; c=relaxed/simple; bh=0oWrfLaJ87SeIic+Mfx4k5icKZ3Es+KFlCWR9h2BViM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=ZxmqDASeco1ReR0WvwapFO4qO51q9DnBf1jJPs9rtT+txc7YUgjEL3o/y1ChJGR35FAc2Yor/v0NLrhm2WtcG9T5OuXhGl5kpMCM2Y5CBeB5xOd+x1IKCv7DSQ9y9BFiS8dP/41BF1ZlwIij9x1j9blC9VlcESlCiXgfh1D/Z/g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 50A1B1FD18; Wed, 14 Feb 2024 17:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707930949; 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=NnPZIUFt+ZzAlQIjwzeKxBxAIB5ob8/BCM5ixaIyKxE=; b=aYQ2n30KJHKFCsFcY52ggArNHANkQHrYRF/TpHnm72VV2GeEBiK+eGVtEsDQnuBIM+cRa6 CdSQ8Nppk+k1z09o38ms/+9WdjDzlptm1srxN301oxIqVKKoGQA+ocwxk+kPQn5EcAYSeG yeYkx8tssRYiuuHdq5GWehRoK/AikRA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707930949; 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=NnPZIUFt+ZzAlQIjwzeKxBxAIB5ob8/BCM5ixaIyKxE=; b=DmSNCgGEcP8krlTMSlsCxMq4ZS3+WFKoJfAtQLzurhZewsWz664h8IKzk5suuLnEX1OtKb KAvm6QV/hvibivAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1707930949; 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=NnPZIUFt+ZzAlQIjwzeKxBxAIB5ob8/BCM5ixaIyKxE=; b=aYQ2n30KJHKFCsFcY52ggArNHANkQHrYRF/TpHnm72VV2GeEBiK+eGVtEsDQnuBIM+cRa6 CdSQ8Nppk+k1z09o38ms/+9WdjDzlptm1srxN301oxIqVKKoGQA+ocwxk+kPQn5EcAYSeG yeYkx8tssRYiuuHdq5GWehRoK/AikRA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1707930949; 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=NnPZIUFt+ZzAlQIjwzeKxBxAIB5ob8/BCM5ixaIyKxE=; b=DmSNCgGEcP8krlTMSlsCxMq4ZS3+WFKoJfAtQLzurhZewsWz664h8IKzk5suuLnEX1OtKb KAvm6QV/hvibivAg== 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 38FDE13A6D; Wed, 14 Feb 2024 17:15:49 +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 ZRNsDEX1zGU/RAAAD6G6ig (envelope-from ); Wed, 14 Feb 2024 17:15:49 +0000 Message-ID: Date: Wed, 14 Feb 2024 18:16:04 +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> <8ac3e1d0-7a93-44f0-9568-49d01fe58f9f@suse.de> <87sf1v3vrl.fsf@tromey.com> <38759c3f-9a03-4468-9ddc-aa5ebb983074@suse.de> <87jzn73tpv.fsf@tromey.com> From: Tom de Vries In-Reply-To: <87jzn73tpv.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Level: Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=aYQ2n30K; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=DmSNCgGE X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-9.50 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_TWO(0.00)[2]; MX_GOOD(-0.01)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_HI(-3.50)[suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_IN_DNSWL_HI(-0.50)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -9.50 X-Rspamd-Queue-Id: 50A1B1FD18 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/14/24 17:18, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries 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