From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1672936446; 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=FJ48AOiUKQ/t4xbH6fHkaxuvAIQj7RbhrWvLAjUMtQQ=; b=pDGuCFlpeXIBB93UdM63v8ENJgzPIdd2KKNbD8fe67WuFOT3T1iHtl7uE65CgViVQ8a4xy n1c7wRw8crLYkMBKeGoIWCE/C+g+cgWuwOR3ye8rC49xLVUf0W9MJhKKrjlXbzvU4QE7gH gj5eTxzh8k5uAqSPUPduCuTk/LnkcEM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1672936446; 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=FJ48AOiUKQ/t4xbH6fHkaxuvAIQj7RbhrWvLAjUMtQQ=; b=cSfyazs52bQkhqoEMrPPt9UzKoCsyuJSlx7CJkkGaZdQ8aAU3leYzbcwy5Ux4Tr4u58UUL pjC3IHBfzJD9FuCA== 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> From: Tom de Vries In-Reply-To: <87k021f1q0.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP 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 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