public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tromey@adacore.com>
Cc: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] [gdb/python] Avoid queue.SimpleQueue for python 3.6
Date: Thu, 5 Jan 2023 17:34:05 +0100	[thread overview]
Message-ID: <c3162368-e8ba-768c-c239-b88ada1e84b8@suse.de> (raw)
In-Reply-To: <87k021f1q0.fsf@tromey.com>

On 1/5/23 16:19, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> 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

  reply	other threads:[~2023-01-05 16:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 16:30 [PATCH] Initial implementation of Debugger Adapter Protocol Tom Tromey
2022-09-01 16:38 ` Eli Zaretskii
2022-09-12 19:54 ` Tom Tromey
2022-09-13  2:26   ` Eli Zaretskii
2022-10-06 14:27   ` Tom Tromey
2023-01-02 16:54     ` Tom Tromey
2023-01-03  8:04       ` Tom de Vries
2023-01-03 14:14         ` Tom Tromey
2023-01-04 11:59           ` Tom de Vries
2023-01-04 12:27             ` Tom de Vries
2023-01-05  9:49               ` [PATCH] [gdb/python] Avoid queue.SimpleQueue for python 3.6 Tom de Vries
2023-01-05 15:19                 ` Tom Tromey
2023-01-05 16:34                   ` Tom de Vries [this message]
2023-01-05 17:07                     ` Tom Tromey
2023-01-05 11:35 ` [PATCH] Initial implementation of Debugger Adapter Protocol Tom de Vries
2023-01-05 15:24   ` Tom Tromey
2023-01-05 16:17     ` Tom de Vries
2023-01-06 14:12       ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3162368-e8ba-768c-c239-b88ada1e84b8@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).