From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 9xT2E+pj0GJh4hIAWB0awg (envelope-from ) for ; Thu, 14 Jul 2022 14:43:54 -0400 Received: by simark.ca (Postfix, from userid 112) id 43C5C1E5EA; Thu, 14 Jul 2022 14:43:54 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=cqCUoOcJ; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E8B4A1E222 for ; Thu, 14 Jul 2022 14:43:53 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 580E838582BA for ; Thu, 14 Jul 2022 18:43:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 580E838582BA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1657824232; bh=j5HIxA2aFDoVmZzyaNGdu86eK3rLI67rvBrQ0aZ8azE=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=cqCUoOcJvL9olwkj7ONas5fM/q3QWDK+KTLo3Ne4JhoPEfBY7vQAC8AHLeKQf006p FI5eRcP3o0MLcRIp2piYxZzvUx9k3cTjYjNSNr6DOcnmZkjqvYsKsFRYJ/AaG91Bey F8OTYiUIk1ZIDpj8zOFtEtTZc80Bx6ek3ao+hfGA= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 6A9903858D1E for ; Thu, 14 Jul 2022 18:43:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A9903858D1E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9DDF31FB54; Thu, 14 Jul 2022 18:43:32 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8899E133A6; Thu, 14 Jul 2022 18:43:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8KU4INRj0GLsFAAAMHmgww (envelope-from ); Thu, 14 Jul 2022 18:43:32 +0000 Message-ID: <1d267cea-387f-f2de-ed72-b6020b80bb4e@suse.de> Date: Thu, 14 Jul 2022 20:43:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [committed][gdb/symtab] Fix data race in ~charset_vector Content-Language: en-US To: Tom Tromey , Tom de Vries via Gdb-patches References: <20220714061923.GA543@delia.home> <87mtdbsirb.fsf@tromey.com> In-Reply-To: <87mtdbsirb.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 7/14/22 19:31, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries via Gdb-patches writes: > > Tom> The problem is that we're freeing the charset_vector elements in the destructor, > Tom> which may still be used by a worker thread. > > Could you say how this happens? > What is the worker thread doing? > As I understand it, the worker thread is executing do_finalize which uses a string (host_charset_name or some such) contained in the charset_vector, which is being destroyed in the main thread. But that's a guess, thread sanitizer didn't report what the worker thread was doing: "[failed to restore the stack]". > Normally I think gdb should be waiting for background tasks to finish > before proceeding with this sort of destruction. If this is coming from > the parallel DWARF reader, maybe we need some higher level API to > cleanly shut down those threads first. Well, the worker threads are detached, so they run until process exit. We can not detach them, and do a join, but that postpones process exit. We could try to do pthread_cancel, but still there might be some waiting involved. This was sofar the only case I found of this type of race, so I thought it reasonable to fix like this. If there are more cases, that might not be practical. Thanks, - Tom