Bug 840 - infinite loop in unbound_munin_ plugin
infinite loop in unbound_munin_ plugin
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
unspecified
x86_64 Linux
: P5 minor
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-09-29 13:42 CEST by Vaclav Danek
Modified: 2016-09-29 13:50 CEST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vaclav Danek 2016-09-29 13:42:51 CEST
Description of problem:
unbound_munin_ plugin loops infinitely when unable to get lock

Version-Release number of selected component (if applicable):
unbound-1.4.20-26.el7.x86_64
munin-node-2.0.25-11.el7.noarch
plugin downloaded from http://unbound.nlnetlabs.nl/svn/trunk/contrib/unbound_munin_

How reproducible:
Execute munin-run unbound_munin_queue when plugin is not configured to run as root

Steps to Reproduce:
1. comment user root in plugin config file
2. execute munin-run unbound_munin_queue

Actual results:
a lot of
/etc/munin/plugins/unbound_munin_queue: line 153: /var/lib/munin/plugin-state/unbound-state.lock: Permission denied
/etc/munin/plugins/unbound_munin_queue: line 153: /var/lib/munin/plugin-state/unbound-state.lock: Permission denied
...
, cpu overloaded, munin-node unresponsive

Expected results:
some fine error message and munin-node not locked in that plugin
Comment 1 Wouter Wijngaards 2016-09-29 13:50:32 CEST
Hi Vaclav,

Here is a patch!

Thanks for the report, the patch is also integrated into the code repository.

Index: contrib/unbound_munin_
===================================================================
--- contrib/unbound_munin_	(revision 3872)
+++ contrib/unbound_munin_	(working copy)
@@ -150,7 +150,7 @@
 			fi
 		done
 		# try to get it
-		echo $$ >$lock
+		if echo $$ >$lock ; then : ; else break; fi
 	done
 	# do not refetch if the file exists and only LEE seconds old
 	if test -f $state; then


Best regards, Wouter