From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WOTtIhT8tmORDBAAWB0awg (envelope-from ) for ; Thu, 05 Jan 2023 11:34:28 -0500 Received: by simark.ca (Postfix, from userid 112) id 7C8621E222; Thu, 5 Jan 2023 11:34:28 -0500 (EST) 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=OxsHz/GX; 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=-6.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.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 2D9041E0D3 for ; Thu, 5 Jan 2023 11:34:28 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7FEE23858C54 for ; Thu, 5 Jan 2023 16:34:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FEE23858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672936467; bh=FJ48AOiUKQ/t4xbH6fHkaxuvAIQj7RbhrWvLAjUMtQQ=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=OxsHz/GXT+2gIk3J4BCx5u09oMEaQTw3IISiHz9oW39ks9eV5UCvOnnJvbhi78Qe9 9URS/EZ0AdOIj9uaQrgYU8ohRYneIyHeojhXMMDovX21JZ35MMX5K4aqKYbNaKv6OB xzueMZuzoUGHHgt0yOBo5fpeGwhUUcsxPDtBgRrs= Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 469B63858D28 for ; Thu, 5 Jan 2023 16:34:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 469B63858D28 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-out1.suse.de (Postfix) with ESMTPS id 5121221F54; Thu, 5 Jan 2023 16:34:06 +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 3A08D13338; Thu, 5 Jan 2023 16:34:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XlPvDP77tmMjTAAAMHmgww (envelope-from ); Thu, 05 Jan 2023 16:34:06 +0000 Message-ID: Date: Thu, 5 Jan 2023 17:34:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH] [gdb/python] Avoid queue.SimpleQueue for python 3.6 Content-Language: en-US To: Tom Tromey Cc: Tom Tromey via Gdb-patches References: <20220901163059.3678708-1-tromey@adacore.com> <87bkrk8j21.fsf@tromey.com> <877d1duivp.fsf@tromey.com> <87k024khch.fsf@tromey.com> <5cd9edba-b1b2-060e-d8d2-98ff6d28a5e7@suse.de> <87tu17iu2j.fsf@tromey.com> <7f2d41d6-ba52-a7da-4144-a252aabd10ea@suse.de> <0b6635ea-ee55-1edd-6f4b-149a3ab200f5@suse.de> <87k021f1q0.fsf@tromey.com> In-Reply-To: <87k021f1q0.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 1/5/23 16:19, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries writes: > > Tom> Fixed by attached commit, any comments? > > Thank you for working on this. I saw your note yesterday but was too > busy to address it. > > Tom> + if sys.version_info[0] == 3 and sys.version_info[1] <= 6: > Tom> + self.write_queue = queue.Queue() > Tom> + else: > Tom> + self.write_queue = queue.SimpleQueue() > > It wasn't clear to me what happens with Queue if task_done is never > called. Like, does it "leak" memory? This is why I chose SimpleQueue. > > Maybe we can just switch to Queue entirely and have the popping code > also call task_done immediately. That seems ok since we don't use join. > I guess what I would do here is have a helper module that uses > SimpleQueue if it is available, and otherwise implements a look-alike > using Queue. > > I don't know if I can work on this today but I will get to it soon, > unless you feel like trying it out. > > If Queue can be dropped in like your patch without any negative effects, > then that's also totally fine by me. I agree that the semantics as advertised for task_done are a bit vague. I read about it a bit here ( https://stackoverflow.com/questions/49637086/python-what-is-queue-task-done-used-for ) to understand what it's supposed to do and looked at the implementation here ( https://github.com/python/cpython/blob/master/Lib/asyncio/queues.py ), and by now I'm convinced that there's no memory leak. So I'll commit shortly. Thanks, - Tom