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

BUG #5066: plperl issues with perl_destruct() and END blocks

From: "Tim Bunce" <Tim(dot)Bunce(at)pobox(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5066: plperl issues with perl_destruct() and END blocks
Date: 2009-09-19 19:21:41
Message-ID: 200909191921.n8JJLfGN052323@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      5066
Logged by:          Tim Bunce
Email address:      Tim(dot)Bunce(at)pobox(dot)com
PostgreSQL version: 8.4.1
Operating system:   darwin
Description:        plperl issues with perl_destruct() and END blocks
Details: 

The plperl implementation doesn't call perl_destruct() during server
shutdown.

So any resources held by references, in %_SHARED for example, are not
properly freed. The perl interpreter never gets a chance to cleanup, it's
simply discarded.

Related to the above, plperl should also set PL_exit_flags |=
PERL_EXIT_DESTRUCT_END. Currently any END blocks defined during
initialization get executed at initialization (just before perl_run()
returns).  Any END blocks defined later never get run.

Setting PL_exit_flags |= PERL_EXIT_DESTRUCT_END in plperl_init_interp() and
calling perl_destruct() will fix the issue.

The timing of the perl_destruct() call (i.e., early or late in the shutdown
sequence) doesn't matter much. You might want to make the spi_* functions
return an error if there's a shutdown in progress.

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2009-09-19 19:53:41
Subject: Re: BUG #5066: plperl issues with perl_destruct() and END blocks
Previous:From: Jesse MorrisDate: 2009-09-19 02:31:49
Subject: BUG #5065: pg_ctl start fails as administrator, with "could not locate matching postgres executable"

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