author | Sebastian Harl <sh@tokkee.org> | |
Sun, 20 May 2007 20:58:03 +0000 (22:58 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Mon, 21 May 2007 05:17:48 +0000 (07:17 +0200) | ||
commit | 402f6df1e035c588f809eb4a85650c5ef3e4d082 | |
tree | bd327578537564c8436f805eb5092ecc510e2e64 | tree | snapshot |
parent | aed9a008cc5d155fc08f69f3e1da1e3069deaf13 | commit | diff |
perl plugin: Unregister all callbacks from collectd when shutting down.
If we do not unregister the callbacks there is still an entry point into the
plugin after Perl has been shut down and its memory has been freed. This will
cause segmentation faults if collectd tries to call any of the registered
callbacks, e.g. by some plugin calling plugin_log () during shutdown.
Important note: Unregistering the shutdown callback during shutdown is
somewhat tricky. Doing that frees the llist_t entry in plugin.c:list_shutdown.
This might cause a segfault in plugin_shutdown_all () when it tries to access
the next pointer of that entry. If plugin_unregister_shutdown () is the last
statement before the return from the shutdown callback this should be save in
about 99% of all cases. Still there should be some better way to handle this.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
If we do not unregister the callbacks there is still an entry point into the
plugin after Perl has been shut down and its memory has been freed. This will
cause segmentation faults if collectd tries to call any of the registered
callbacks, e.g. by some plugin calling plugin_log () during shutdown.
Important note: Unregistering the shutdown callback during shutdown is
somewhat tricky. Doing that frees the llist_t entry in plugin.c:list_shutdown.
This might cause a segfault in plugin_shutdown_all () when it tries to access
the next pointer of that entry. If plugin_unregister_shutdown () is the last
statement before the return from the shutdown callback this should be save in
about 99% of all cases. Still there should be some better way to handle this.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
src/perl.c | diff | blob | history |