Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1elztz-0003Tc-Or for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Feb 2018 16:27:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elzty-0002ZP-RW for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Feb 2018 16:27:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1elzty-0002ZF-BT for pgsql-hackers@lists.postgresql.org; Wed, 14 Feb 2018 16:27:22 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1elztq-0006H8-St for pgsql-hackers@postgresql.org; Wed, 14 Feb 2018 16:27:21 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id B2C4621C2A6F; Wed, 14 Feb 2018 19:27:11 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from mail.postgrespro.ru (cyclops.l.postgrespro.ru [192.168.27.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 7F5C721C273D; Wed, 14 Feb 2018 19:27:11 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1518625631; bh=quCjLN4HCN3Vl6RfhigjslkAnzMVXb61s1Jt/aYZJ48=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=O9eF+riSWln/Y3DMno6OPbwS0FJG8Fo0b8fBkfTq2gMRF9sYdNUXrFb01XIsWTcLP 8mYFqt5giN7iH1BrJ0U9gHHnSKuptfvQn6A0b/CRIqNLZHLTSwLJnouIIeW21WkkFz LaNRkGw7s1q9VA3bw8LF67WHRayo5sGRu6o5+eTk= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 14 Feb 2018 19:27:11 +0300 From: Marina Polyakova To: Tom Lane Cc: Peter Eisentraut , pgsql-hackers@postgresql.org Subject: Re: master plpython check fails on Solaris 10 Organization: Postgres Professional In-Reply-To: <17568.1518620054@sss.pgh.pa.us> References: <156b989dbc6fe7c4d3223cf51da61195@postgrespro.ru> <4a5588c7-9bcc-d5f5-b952-6b260467fc71@2ndquadrant.com> <2982e7d95f11eea5599f8141efbf4b2d@postgrespro.ru> <17568.1518620054@sss.pgh.pa.us> Message-ID: <82168d2485db48a0267c1451ed357651@postgrespro.ru> X-Sender: m.polyakova@postgrespro.ru User-Agent: Roundcube Webmail/1.2.4 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 14-02-2018 17:54, Tom Lane wrote: > Marina Polyakova writes: >> On 14-02-2018 3:43, Peter Eisentraut wrote: >>> OK, can you get some kind of stack trace or other debugging >>> information? > >> I got this backtrace from gdb: > > Hmm, so the only question in my mind is how did this ever work for > anyone? > > The basic problem here is that, instead of using the > ErrorContextCallback.arg field provided for the purpose, > plpython_error_callback is using PLy_current_execution_context() > to try to identify the context it's supposed to report on. > In the example, that points to the context associated with the > inner DO block, not with the outer procedure. That context > looks like it should reliably have curr_proc->proname == NULL, > so how come this test case doesn't crash for everybody? > > In any case the expected output for the transaction_test4 > case is obviously wrong. Rather than reporting the transaction_test4 > function and then the inner DO block, it's reporting 2 levels > of transaction_test4. That seems to trace directly to both levels > of error context callback looking at the same execution context. > > I think we need to fix the error callback code so that it > uses the "arg" field to find the relevant procedure, and that > that's a back-patchable fix, because nested plpython functions > would show this up as wrong in any case. That would also let us > undo the not-terribly-safe practice of having code between the > PLy_push_execution_context call and the PG_TRY that is supposed > to ensure the context gets popped again. Thank you very much! I'll try to implement this. > While I'm bitching ... I wonder how long it's been since the > comment for PLy_procedure_name() had anything to do with its > actual behavior. AFAIU this has always been like that, since the commit 1ca717f3... -- Marina Polyakova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company