when does bind calls plugin_destroy ?
Marcus Kool
marcus.kool at urlfilterdb.com
Tue Nov 29 00:08:30 UTC 2022
On 28/11/2022 22:07, Evan Hunt wrote:
> On Mon, Nov 28, 2022 at 12:53:16PM +0000, Marcus Kool wrote:
>> In a test setup there are two instances of the same plugin and everything
>> works as expected (plugin_register is called twice - once for each view).
>>
>> However, "rndc reconfig" calls plugin_register again twice but does not call
>> plugin_destroy...
> Are you sure it's not being run?
It is run, but...
I see random behavior while I do the same test: start named with unmodified config file with 2 views (each a plugin instance), run the same 40+ queries and reconfigure. repeat: a few more queries and
reconfigure
9.16.1 rarely sees plugin_destroy at first reconfigure, 40% at the second reconfigure for the first time, 60% at the third reconfigure for the first time. Thereafter, after each plugin_register there
is a plugin_destroy.
9.18.9 never seen plugin_destroy at first reconfigure, may take up to 4 reconfigures for plugin_destroy being called. Thereafter, after each plugin_register there is a plugin_destroy.
>> So, does anyone know when plugin_destroy is called and perhaps how a plugin
>> can detect a reconfig is done and can deallocate resources for the plugins
>> registered at startup?
> For each view, "rndc reconfig" is supposed to create and configure a new view,
> move the zones from the old view to the new one, and then destroy the one.
> The destroy function for the view should clean up plugins:
>
> | if (view->plugins != NULL && view->plugins_free != NULL) {
> | view->plugins_free(view->mctx, &view->plugins);
> | }
>
> view->plugins_free is a pointer to ns_plugins_free(), which calls
> unload_plugin() for each plugin configured in the view, and that calls
> the plugin_destroy() function defined in the module.
>
> If you have the logging level set to debug(1), you should see "unloading
> plugin" in your log file when this happens.
Yes, the "unloading plugin" matches the log messages of the plugin.
More information about the bind-users
mailing list