pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marko Tiikkaja <pgmail@joh.to>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7516: PL/Perl crash
Date: Tue, 11 Sep 2012 20:17:24 +0200
Message-ID: <504F8034.20802@joh.to> (raw)
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>

On 10/09/2012 00:37, Tom Lane wrote:
> 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.

Joel Jacobson managed to narrow it down to this test case, which crashes 
consistently on Ubuntu 12.04 both with and without your patch.  I, 
however, wasn't able to reproduce the problem on my OS X Mountain Lion. 
  I'll try to get some more information about it tomorrow, but in the 
mean time if you can reproduce the problem or think of something, I'll 
post the test case.


Regards,
Marko Tiikkaja

Attachments:

perlbug.sql (text/plain, 1.9K) download DROP DATABASE plperlbug; CREATE DATABASE plperlbug; \c plperlbug CREATE LANGUAGE plperlu; CREATE TABLE t1 ( fooid serial not null, foo character(3) NOT NULL, PRIMARY KEY (fooid), UNIQUE (foo) ); CREATE TABLE t2 ( foobarid serial not null, foobar1 character(3) NOT NULL, foobar2 character(3) NOT NULL, PRIMARY KEY (foobarid), UNIQUE (foobar1,foobar2) ); CREATE TABLE t3 ( foobarid integer NOT NULL, foobar4 timestamp with time zone NOT NULL, foo1 numeric NOT NULL, foo2 numeric NOT NULL, foo3 interval NOT NULL, PRIMARY KEY (foobarid), CONSTRAINT t3_foo1_check CHECK ((foo1 > (0)::numeric)) ); CREATE OR REPLACE FUNCTION func0001(_foobar1 character, _foobar2 character) RETURNS integer AS $BODY$ SELECT foobarid FROM t2 WHERE foobar1 = $1 AND foobar2 = $2 $BODY$ LANGUAGE sql; CREATE OR REPLACE FUNCTION func0005() RETURNS record LANGUAGE plperlu AS $BODY$ use strict; use warnings; die "die for fun"; $BODY$; CREATE OR REPLACE FUNCTION func0002( OUT foobar4_ timestamp with time zone, OUT foo1_ numeric, OUT foo2_ numeric, _foobar1 character, _foobar2 character, _foobar3 timestamp with time zone ) RETURNS record AS $BODY$ DECLARE _foobarid integer; _foo3 interval; BEGIN _foobarid := func0001(_foobar1, _foobar2); BEGIN RAISE DEBUG '% % %', 'a', 'b', 'c'; PERFORM func0005(); EXCEPTION WHEN OTHERS THEN RAISE DEBUG '%', 'foo'; SELECT foobar4, foo1, foo2, foo3 INTO foobar4_, foo1_, foo2_, _foo3 FROM t3 WHERE foobarid = 12345; END; RETURN; END; $BODY$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION func0003() RETURNS boolean AS $FUNC$ use strict; use warnings; my $prepared = spi_prepare('SELECT * FROM func0002($1,$2,NULL)', 'VARCHAR','VARCHAR'); my $a = spi_exec_prepared($prepared,'AAA','BBB')->{rows}->[0]->{fx}; my $b = spi_exec_prepared($prepared,'AAA','BBB')->{rows}->[0]->{fx}; return 1; $FUNC$ LANGUAGE plperlu; SELECT func0003();

view thread (18+ messages)  latest in thread

Message-ID: <504F8034.20802@joh.to>
Permalink:  ../504F8034.20802@joh.to/
Also on:    postgresql.org/message-id/504F8034.20802@joh.to

 · 

reply

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: pgmail@joh.to, tgl@sss.pgh.pa.us
  Subject: Re: BUG #7516: PL/Perl crash
  In-Reply-To: <504F8034.20802@joh.to>
  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> <504F8034.20802@joh.to>

* 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