From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marko Tiikkaja <pgmail@joh.to>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7516: PL/Perl crash
Date: Sun, 09 Sep 2012 18:37:58 -0400
Message-ID: <17785.1347230278@sss.pgh.pa.us> (raw)
In-Reply-To: <16153.1347226320@sss.pgh.pa.us>
References: <E1T8YUZ-0006gb-Oz@wrigleys.postgresql.org>
<1194.1346688396@sss.pgh.pa.us>
<5047BA9C.2040405@joh.to>
<16153.1347226320@sss.pgh.pa.us>
I wrote:
> Hm. Well, I can definitely reproduce a segfault using this example:
> CREATE OR REPLACE FUNCTION self_modify(INTEGER) RETURNS INTEGER AS $$
> spi_exec_query('CREATE OR REPLACE FUNCTION self_modify(INTEGER) RETURNS INTEGER AS \'return $_[0] * 3;\' LANGUAGE plperl;');
> spi_exec_query('select self_modify(42) AS a');
> return $_[0] * 2;
> $$ LANGUAGE plperl;
> select self_modify(42);
> So I think we need to institute a reference counting scheme for
> the plperl_proc_desc records ...
The attached patch fixes the problem I'm seeing. I am not sure whether
it fixes what you saw; the crash you showed is in the right place, but
unless there was a recursive call to a pl/perl function, I don't see
how the existing code could have freed the prodesc too soon.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgmail@joh.to
Subject: Re: BUG #7516: PL/Perl crash
In-Reply-To: <17785.1347230278@sss.pgh.pa.us>
References: <E1T8YUZ-0006gb-Oz@wrigleys.postgresql.org> <1194.1346688396@sss.pgh.pa.us> <5047BA9C.2040405@joh.to> <16153.1347226320@sss.pgh.pa.us> <17785.1347230278@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox