From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111181 invoked by alias); 10 Oct 2018 14:07:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 111171 invoked by uid 89); 10 Oct 2018 14:07:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=initiated, unsure, forbid X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (192.185.186.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Oct 2018 14:07:49 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 7708F400D72F7 for ; Wed, 10 Oct 2018 08:14:26 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id AF9Pg64M0FxNhAF9PgQpRN; Wed, 10 Oct 2018 09:07:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RMwICOG51+qlv4sDzDT5RTwsRgFo7aPyRTDW6QVHr9g=; b=NMbsjQeE98pJWGyMHRRWD9ShBN 3COrkXVJhtM2vbFRmoI7Uyf/yhzVP/Wk7pXAlAcZZrTFsfc5dEtjLHS4dmLsiCvnEAaGh35LDZ/tG spU9Si0nWg9ZCYm1codRICyMC; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:36514 helo=pokyo) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gAF9P-001hzr-F1; Wed, 10 Oct 2018 09:07:47 -0500 From: Tom Tromey To: Phil Muldoon Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFC] Release the GIL while running a gdb command or expression References: <20180915040732.6718-1-tom@tromey.com> <807f284a-e227-37ed-c197-170a7f2abe40@redhat.com> <874ldugb5e.fsf@tromey.com> <6503980f-f5ab-ecab-37a5-993d9daec226@redhat.com> Date: Wed, 10 Oct 2018 14:07:00 -0000 In-Reply-To: <6503980f-f5ab-ecab-37a5-993d9daec226@redhat.com> (Phil Muldoon's message of "Wed, 10 Oct 2018 09:33:04 +0100") Message-ID: <87va69evyl.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-10/txt/msg00257.txt.bz2 >>>>> "Phil" == Phil Muldoon writes: >> I don't think this is necessary, mostly because I can't think of when it >> would be desirable not to release the GIL; but also because when writing >> Python one doesn't normally have to worry about the GIL -- it's not >> really a Python-visible feature, nor should it be, since implementations >> like PyPY don't have it. Phil> It's not so much an implementation detail that should be exposed to Phil> the user but rather a change in behavior around gdb.execute. Given Phil> that now, with this patch, we always release the Python GIL during the Phil> execution of a GDB command via gdb.execute, any other Python thread Phil> that was previously blocked by the GIL is now unblocked, and it may Phil> appear to those threads that the Python thread that initiated the Phil> gdb.execute has returned from that command when it may not have (this Phil> is especially so in cases where a GDB command takes seconds to Phil> complete a command). Also, any other Python threads that wish to Phil> interact with GDB will have to wait until the GDB event loop returns Phil> to a state where it is accepting input (at least I think this is Phil> true). Actually we forbid using gdb APIs from threads other than the gdb thread. From python.texi: @value{GDBN} is not thread-safe. If your Python program uses multiple threads, you must be careful to only call @value{GDBN}-specific functions in the @value{GDBN} thread. @code{post_event} ensures this. Phil> This may break some scripts out there. Are these scripts Phil> relying on what we now classify as a bug or is there is a reasonable Phil> expectation, on the users' behalf, that a script could rely on GDB's Phil> previous GIL blocking behavior? I'm not advocating we should have a Phil> release_gil parameter, I'm just unsure of the expectations of users Phil> and scripts out there, and that if we don't provide a mechanism to Phil> optionally block the GIL, it will cause disruption to any established Phil> scripts out there. Phil> I suppose the solution is to either provide a GIL blocking parameter Phil> or to thoroughly document this new behavior in the manual. What do Phil> you think? I think there's little risk of this breaking anything. It seems like just an ordinary bug fix to me. Tom