Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Paul_Koning@dell.com
Cc: omeragacan@gmail.com, gdb@sourceware.org
Subject: Re: recursion limit exceeded in Python API, but there's only one function in traceback
Date: Fri, 17 Oct 2014 17:31:00 -0000	[thread overview]
Message-ID: <5441525B.3040801@redhat.com> (raw)
In-Reply-To: <2BD7D737-CFF3-4368-9265-25C6611CF40C@dell.com>

On 17/10/14 16:04, Paul_Koning@dell.com wrote:
>
> On Oct 17, 2014, at 6:11 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
>
>> ...
>> Right.  gdb.execute won't return until the command has completed.
>> Also the Python GIL has been acquired (as this is coming from the
>> Python interpreter) and so now Python is also blocked too.  So in
>> effect the only thing running at this point is the gdb.execute command
>> that was invoked (in your case, the continue command). That will
>> return, and then the Python GIL will be released and the rest of the
>> script will continue.
>>
>> I have a patch I need to upstream that adds a release_gil keyword to
>> gdb.execute.  This optionally releases the GIL before executing the
>> command.  But I have not got around to that yet.
>
> Could you explain why gdb.execute should ever hold onto the GIL while performing the command?  I view gdb.execute as akin to an I/O operation, which releases the GIL around the I/O.  Another way to look at it is that execute is performing a GDB command.  Either that isn’t a Python operation — in which case the GIL is not needed since the data it protects won’t be touched.  Or it is a command that (possibly indirectly) invokes another Python operation — in which case the GIL has to be released or you end up with a deadlock.
>

It (GDB) is not holding the GIL, Python is.  The gdb.execute call at that
point has been called from the Python interpreter, and it has managed
the GIL until that point.

This means in current behavior, say you had three threads running,
they are all suspended during the call to gdb.execute.  A user
submitted a request that we release the GIL (even though GDB did not
acquire it). The patch that I will submit (soon) just releases the GIL
so that on long-lived operations Python threads can still continue to
execute.  It does this with SaveThread/RestoreThread.  There is more
detail on this in the bugzilla posted.

Cheers

Phil


  reply	other threads:[~2014-10-17 17:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 10:46 Ömer Sinan Ağacan
2014-10-16 12:45 ` Phil Muldoon
2014-10-16 14:28   ` Paul_Koning
     [not found]     ` <CAMQQO3=GxjGzF-9RXQsJ_9=Du3rS-UoYFA_0-friPp1nMa8yAA@mail.gmail.com>
2014-10-16 15:04       ` Paul_Koning
2014-10-16 15:15         ` Ömer Sinan Ağacan
2014-10-16 15:18         ` Ömer Sinan Ağacan
2014-10-17  9:31           ` Ömer Sinan Ağacan
2014-10-17 10:11             ` Phil Muldoon
2014-10-17 10:53               ` Ömer Sinan Ağacan
2014-10-17 14:20                 ` Phil Muldoon
2014-10-17 14:27                   ` Ömer Sinan Ağacan
2014-10-17 15:02                     ` Phil Muldoon
2014-10-17 15:04               ` Paul_Koning
2014-10-17 17:31                 ` Phil Muldoon [this message]
2014-10-17 16:41             ` Doug Evans
2014-10-17 17:35               ` Phil Muldoon
2014-10-17 16:45           ` Doug Evans
     [not found]     ` <543FE072.6040507@redhat.com>
2014-10-16 15:16       ` Ömer Sinan Ağacan

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=5441525B.3040801@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=Paul_Koning@dell.com \
    --cc=gdb@sourceware.org \
    --cc=omeragacan@gmail.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