Re: [BUGS] Patch to allow C extension modules to initialize/finish

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: rse(at)engelschall(dot)com, pgsql-hackers(at)postgresql(dot)org, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: [BUGS] Patch to allow C extension modules to initialize/finish
Date: 2006-08-03 21:51:37
Message-ID: 26751.1154641897@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

David Fetter <david(at)fetter(dot)org> writes:
> On Thu, Aug 03, 2006 at 05:30:48PM -0400, Tom Lane wrote:
>> One question I have is whether it really works as expected in all
>> cases. In particular what if the library is "preloaded" into the
>> postmaster?

> I'm not sure quite what you mean here, but PL/PerlU functions can
> use() modules, and those are called per-backend, i.e. when the
> function is invoked. There's also some possibility that something
> might go into %_SHARED.

Well, the point is that you could have a scenario where the PG_init
function is executed in the postmaster, the process image is duplicated
via fork(), and then in a specific backend a LOAD command is executed
causing the PG_fini function to be called. Is it likely that anything
would get confused by PG_init and PG_fini getting called by different
processes?

Also, if we do this we probably ought to remove the special-purpose
hack for preload_libraries to specify an init function --- it should
just happen by default. Any objections to simplifying that?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Dunstan 2006-08-03 21:56:53 Re: [BUGS] Patch to allow C extension modules to initialize/finish
Previous Message David Fetter 2006-08-03 21:37:12 Re: [BUGS] Patch to allow C extension modules to initialize/finish

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-08-03 21:56:53 Re: [BUGS] Patch to allow C extension modules to initialize/finish
Previous Message David Fetter 2006-08-03 21:37:12 Re: [BUGS] Patch to allow C extension modules to initialize/finish