[collectd] patch for SIGSEGV during python plugin configuration in collectd 5.0.0

Luke Heberling collectd at c-ware.com
Fri Jul 1 01:47:43 CEST 2011


Hi List,
I've found that having more than one "Plugin" configuration block for
the python plugin causes a segfault. I first ran into it while trying to
split out some configuration into Includes, but it can be just as easily
reproduced in a single configuration file.

The problem appears to exist because the python plugin unconditionally
initializes itself in the config callback, and if more than one "<Plugin
python>" blocks exist, then the callback is called once for each and
initialization is perfomed repeatedly. My quick-n-dirty "fix" for this
is attached; I simply skip the initialization if it's been done already.
The ModulePath config setting requires some data that's obtained during
the initialization, I sidestepped that problem by rejecting any
ModulePath statements in Plugin config blocks other than the first.

Perhaps there's a better way to go about fixing this problem, but it
does work for me at the moment.

--
Luke Heberling

Backtrace:
#0  0x00007ffff6a37e64 in ?? () from /usr/lib/libpython2.6.so.1.0
#1  0x00007ffff6a9b3ea in PyModule_AddObject () from
/usr/lib/libpython2.6.so.1.0
#2  0x00007ffff6e4106a in cpy_config (ci=0x622200) at python.c:1033
#3  0x00000000004099fd in dispatch_block_plugin (filename=<value
optimized out>) at configfile.c:361
#4  dispatch_block (filename=<value optimized out>) at configfile.c:389
#5  cf_read (filename=<value optimized out>) at configfile.c:942
#6  0x0000000000405f65 in main (argc=4, argv=0x7fffffffe768) at
collectd.c:477


Configuration:
LoadPlugin python
<Plugin python>
        LogTraces false
</Plugin>
<Plugin python>
        LogTraces false
</Plugin>
<Plugin python>
        LogTraces false
</Plugin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python.patch
Type: text/x-diff
Size: 1448 bytes
Desc: not available
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20110630/0e6e8043/attachment.patch>


More information about the collectd mailing list