when does bind calls plugin_destroy ?
Evan Hunt
each at isc.org
Mon Nov 28 22:07:06 UTC 2022
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?
> 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.
--
Evan Hunt -- each at isc.org
Internet Systems Consortium, Inc.
More information about the bind-users
mailing list