You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by "Alan D. Cabrera" <ad...@toolazydogs.com> on 2013/12/29 15:37:22 UTC

TSPluginInit() only being called once

Can I count on TSPluginInit() being called only once in the lifetime of a plugin?


Regards,
Alan


Re: TSPluginInit() only being called once

Posted by Leif Hedstrom <zw...@apache.org>.
On Dec 30, 2013, at 7:08 PM, Nick Kew <ni...@apache.org> wrote:

> 
> On 31 Dec 2013, at 00:22, Leif Hedstrom wrote:
> 
>> Sort of, but it doesn't reload the plugin code itself. A lot if people want to be able to reload an updated .so on a live system. The reason I brought this up is because a future version if ATS that supports this presumably need to call the init function again. So semantics might change :).
> 
> A plugin could take charge of that.  Libloader springs to mind:
> - it loads libraries.  It could optionally run a TSPluginInit.
> - it could introduce a TSMgmtUpdate function to unload/reload.
> 
> That would turn it from a trivial utility to something interesting!

Sounds cool, do it! :-).

One concern, not sure if it’s real or not, is how to deal with the fact that ATS might be in the middle of running with the old code, as libloader wants to link in the new version. Somehow, I think you’ll have to deal with keep multiple versions of the plugin code around, until all the old transactions have drained ? I.e. is it possible to do this without additions / modifications to the core. Or maybe libloader moves into the core?

Cheers,

— leif


Re: TSPluginInit() only being called once

Posted by Nick Kew <ni...@apache.org>.
On 31 Dec 2013, at 00:22, Leif Hedstrom wrote:

> Sort of, but it doesn't reload the plugin code itself. A lot if people want to be able to reload an updated .so on a live system. The reason I brought this up is because a future version if ATS that supports this presumably need to call the init function again. So semantics might change :).

A plugin could take charge of that.  Libloader springs to mind:
 - it loads libraries.  It could optionally run a TSPluginInit.
 - it could introduce a TSMgmtUpdate function to unload/reload.

That would turn it from a trivial utility to something interesting!

-- 
Nick Kew


Re: TSPluginInit() only being called once

Posted by Leif Hedstrom <zw...@apache.org>.
On Dec 30, 2013, at 2:01 AM, Nick Kew <ni...@apache.org> wrote:
> 
> 
>> On 29 Dec 2013, at 16:56, Leif Hedstrom wrote:
>> 
>>> On Dec 29, 2013, at 7:37 AM, Alan D. Cabrera <ad...@toolazydogs.com> wrote:
>>> 
>>> Can I count on TSPluginInit() being called only once in the lifetime of a plugin?
>> 
>> 
>> Currently, yes.
>> 
>> There has been a number of discussions on the topic of making it possible to reload plugins on a "live" system.
> 
> Isn't that a separate issue?  A plugin can register an alternative-init
> function that works as a reload-init with TSMgmtUpdateRegister,
> just subject to TS-2036.


Sort of, but it doesn't reload the plugin code itself. A lot if people want to be able to reload an updated .so on a live system. The reason I brought this up is because a future version if ATS that supports this presumably need to call the init function again. So semantics might change :).

Cheers

-- Leif 
> 
> -- 
> Nick Kew

Re: TSPluginInit() only being called once

Posted by Nick Kew <ni...@apache.org>.
On 29 Dec 2013, at 16:56, Leif Hedstrom wrote:

> On Dec 29, 2013, at 7:37 AM, Alan D. Cabrera <ad...@toolazydogs.com> wrote:
> 
>> Can I count on TSPluginInit() being called only once in the lifetime of a plugin?
>> 
> 
> 
> Currently, yes.
> 
> There has been a number of discussions on the topic of making it possible to reload plugins on a "live" system. 

Isn't that a separate issue?  A plugin can register an alternative-init
function that works as a reload-init with TSMgmtUpdateRegister,
just subject to TS-2036.

-- 
Nick Kew

Re: TSPluginInit() only being called once

Posted by Leif Hedstrom <zw...@apache.org>.
On Dec 29, 2013, at 7:37 AM, Alan D. Cabrera <ad...@toolazydogs.com> wrote:

> Can I count on TSPluginInit() being called only once in the lifetime of a plugin?
> 


Currently, yes.

There has been a number of discussions on the topic of making it possible to reload plugins on a "live" system. Nothing like that is in place now, code is only loaded once, and the plugin init callback is only called once. For remap plugins, the instantiation callback can be called any number of times, to accommodate multiple remap rules as well as reloading remap.config.

Cheers,

-- Leif