Re: Plugins redux (was Re: [PATCHES] PL instrumentation - Mailing list pgsql-hackers

From korryd@enterprisedb.com
Subject Re: Plugins redux (was Re: [PATCHES] PL instrumentation
Date
Msg-id 1155250990.24313.114.camel@sakai.localdomain
Whole thread Raw
In response to Re: Plugins redux (was Re: [PATCHES] PL instrumentation plugin  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Plugins redux (was Re: [PATCHES] PL instrumentation
List pgsql-hackers
<blockquote type="CITE"><pre>
<font color="#000000">> Also, should we create an on_proc_exit() handler that would unload all</font>
<font color="#000000">> dynamic libraries (specifically to call the _PG_fini() functions)? </font>

<font color="#000000">Yeah, I thought about that too, but I'm inclined not to do it;</font>
<font color="#000000">it seems like just excess cycles.  The process is quitting anyway,</font>
<font color="#000000">so the only reason this would be useful is if the library thinks it's</font>
<font color="#000000">going to update external or shared state during _PG_fini ... and on</font>
<font color="#000000">the whole that sounds like a bad idea.  Besides, if a library really</font>
<font color="#000000">needs this it can add its own on_proc_exit handler.</font>
</pre></blockquote><br /> It seems a little dangerous for a dynamic library to register an on_proc_exit() handler.  If
weever add support for unloading a dynamic library, we'll have to add an unregister_on_proc_exit() too. Otherwise, a
dynamiclibrary might register a function pointer with on_proc_exit() and then leave a dangling pointer when it gets
unloaded.<br/><br /> Given that, I assume you don't feel the need to unload old shared libraries if the user (a
superuser)removes an entry from backend_load_libraries, right?<br /><br /> In fact, it looks _PG_fini() is only called
ifyou *reload* a library, unless I'm missing something somwhere.<br /><table cellpadding="0" cellspacing="0"
width="100%"><tr><td><br/><br /> --<br />   Korry Douglas    <a
href="mailto:korryd@enterprisedb.com">korryd@enterprisedb.com</a><br/>   EnterpriseDB      <a
href="http://www.enterprisedb.com">http://www.enterprisedb.com</a></td></tr></table>

pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: 8.2 features status
Next
From: Alvaro Herrera
Date:
Subject: Re: 8.2 features status