Title: [opsview-base] [151] Fixed Opsview installs hanging issue, due to filehandles left open by worker threads
- Revision
- 151
- Author
- tvoon
- Date
- 2012-12-12 17:44:26 +0000 (Wed, 12 Dec 2012)
Log Message
Fixed Opsview installs hanging issue, due to filehandles left open by worker threads
Modified Paths
Added Paths
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2012-12-07 17:29:10 UTC (rev 150)
+++ trunk/Makefile 2012-12-12 17:44:26 UTC (rev 151)
@@ -552,6 +552,8 @@
# nagios_free_objects_fix.patch is a bug fix. The Nagios people might
# fix it themselves sometime.
cd ${NAGIOS} && patch -p1 < ../patches/nagios_free_objects_fix.patch
+ # Below required otherwise installs hang
+ cd ${NAGIOS} && patch -p1 < ../patches/nagios_daemonise_worker_helpers.patch
if [ $(KERNEL_NAME) = Linux ] ; then \
cd ${NAGIOS} && CFLAGS="${CFLAGS}" ./configure --with-nagios-user=$(NAGIOS_USER) --with-nagios-group=$(NAGIOS_GROUP) --with-command-group=$(NAGIOS_GROUP) --with-cgiurl=/cgi-bin --with-htmurl=/ --enable-libtap ; \
elif [ $(KERNEL_NAME) = Darwin ] ; then \
Added: trunk/patches/nagios_daemonise_worker_helpers.patch
===================================================================
--- trunk/patches/nagios_daemonise_worker_helpers.patch (rev 0)
+++ trunk/patches/nagios_daemonise_worker_helpers.patch 2012-12-12 17:44:26 UTC (rev 151)
@@ -0,0 +1,17 @@
+diff -ur nagios-4.0.20121205/lib/worker.c nagios-4.0.20121205.daemonised_workers/lib/worker.c
+--- nagios-4.0.20121205/lib/worker.c 2012-11-16 12:38:06.000000000 +0000
++++ nagios-4.0.20121205.daemonised_workers/lib/worker.c 2012-12-12 17:42:11.000000000 +0000
+@@ -684,6 +684,13 @@
+ if (pid)
+ return pid;
+
++ // Opsview patch: Have to close these fds so that they don't get left open by upper programs. Installs can hang otherwise
++ setsid();
++ close(0); close(1); close(2);
++ open("/dev/null", O_RDONLY);
++ open("/dev/null", O_WRONLY);
++ open("/dev/null", O_WRONLY);
++
+ ret = execvp(argv[0], argv);
+ /* if execvp() fails, there's really nothing we can do */
+ exit(ret);
_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins