[collectd-changes] collectd, the system statistics collection daemon: Changes to 'master'
octo at verplant.org
Mon Aug 11 17:08:55 CEST 2008
bindings/perl/Collectd.pm | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
Author: Sebastian Harl <sh at tokkee.org>
Date: Sat Aug 2 00:50:18 2008 +0200
bindings/perl/Collectd.pm: Improved the way access to @plugins is synchronized.
So far, a lock has been placed on @plugins, so that no two threads could
access the list of plugins simultaneously. This could cause problems which in
certain situations could even lead to deadlocks. E.g. when using the perl
plugin in combination with the rrdtool plugin with debugging enabled one would
get hit by the following situation: the perl plugin holds the lock on @plugins
and then dispatches values to the rrdtool plugin from some Perl plugin's read
function. The rrdtool plugin then tries to acquire its cache lock. At the same
time some other plugin dispatches values to the rrdtool plugin as well and
this thread now holds the lock on the rrdtool cache. While holding that lock,
the rrdtool plugin might dispatch a debug logging message and thus calls the
perl plugin's log-callback which tries to get the lock on @plugins thus
causing a deadlock.
This has been resolved by the following two changes:
* Restrict the lock to the list of plugins of one type. This allows to access
e.g. read and log plugins in parallel.
* Unlock the variable before calling the Perl callback function. This
further prevents nested locks.
Signed-off-by: Sebastian Harl <sh at tokkee.org>
Signed-off-by: Florian Forster <octo at huhu.verplant.org>
More information about the collectd-changes