Skip site navigation (1) Skip section navigation (2)

pgsql: Make plperl safe against functions that are redefined whilerunn

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make plperl safe against functions that are redefined whilerunn
Date: 2012-09-10 00:33:39
Message-ID: E1TArwZ-0008SY-Ub@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Make plperl safe against functions that are redefined while running.

validate_plperl_function() supposed that it could free an old
plperl_proc_desc struct immediately upon detecting that it was stale.
However, if a plperl function is called recursively, this could result
in deleting the struct out from under an outer invocation, leading to
misbehavior or crashes.  Add a simple reference-count mechanism to
ensure that such structs are freed only when the last reference goes
away.

Per investigation of bug #7516 from Marko Tiikkaja.  I am not certain
that this error explains his report, because he says he didn't have
any recursive calls --- but it's hard to see how else it could have
crashed right there.  In any case, this definitely fixes some problems
in the area.

Back-patch to all active branches.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/ef06dca97504cda3cff852314532338c86d3ccc5

Modified Files
--------------
src/pl/plperl/expected/plperl.out |   18 ++++++
src/pl/plperl/plperl.c            |  104 +++++++++++++++++++++++++------------
src/pl/plperl/sql/plperl.sql      |   10 ++++
3 files changed, 99 insertions(+), 33 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-09-10 00:33:40
Subject: pgsql: Make plperl safe against functions that are redefined whilerunn
Previous:From: Tom LaneDate: 2012-09-09 19:09:33
Subject: pgsql: Use .NOTPARALLEL in ecpg/Makefile to avoid a gmake parallelismb

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group