Bug#311695: [Pkg-nagios-devel] Bug#311695: hey, let's loop endlessly doing sql statements!

Andres Salomon Andres Salomon <dilinger@debian.org>, 311695@bugs.debian.org
Fri, 03 Jun 2005 16:55:33 -0400

Content-Type: text/plain
Content-Transfer-Encoding: 7bit

severity 311695 important

On Fri, 2005-06-03 at 16:44 -0400, sean finney wrote:
> On Fri, Jun 03, 2005 at 12:25:38PM -0400, Andres Salomon wrote:
> > severity 311695 critical
> > thanks
> > 
> > Bumping severity back to RC, as I can now reproduce this easily, it
> > breaks the system, it causes data loss, it raped my cat, it really is
> > evil behavior, and we already know how to fix it.

Ok, I'm no longer 100% sure that I managed to reproduce it w/
mysql-server 4.0.42-10; I think I shut down nagios via the init script,
which doesn't actually kill it.  I might've been seeing the prior nagios
instance spinning, filling up logs.  Or maybe I did actually kill it,
I'm not too sure anymore.  Reproducing it has been a pain (sometimes it
works, sometimes it doesn't), so I'm giving up for now, and reducing the
severity.  If someone wants to take over and try reproducing it w/ -10,
please go ahead and try, and bump the severity appropriately.

> okay, well i see a few options:
> - try and patch nagios source for nagios-mysql at the last minute.
> - take our time, keep the rc bug and put the fix in 3.1r1
> - have nagios not start by default (at least for nagios-mysql, if
>   that's possible)

The attached patch fixes the problem for me, afaict.  It's basically
what I described earlier; return ERROR instead of continuing.

> i don't like the first one, and the third one also requires a
> non-trivial amount of code change and affects the other two
> versions of nagios which might not have this problem.  so given
> this, plus the fact that there's an easy workaround (follow directions
> and configure your server), i don't think that the world would end
> if this fix didn't make it in in time for sarge.

There is, of course, a fourth option; don't ship nagios w/ an example
setup that doesn't actually work.  There's really no need to include the
'gw' host, is there?  Or will nagios refuse to start if there are no
hosts defined?

Anyways, while I'd prefer to see this fixed ASAP, I'm fine w/ it
entering proposed-updates and showing up in r1.

Content-Disposition: attachment; filename=nagios.patch
Content-Type: text/x-patch; name=nagios.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

diff -urN nagios-1.3-cvs.20050402.orig/xdata/xrddb.c nagios-1.3-cvs.20050402/xdata/xrddb.c
--- nagios-1.3-cvs.20050402.orig/xdata/xrddb.c	2005-04-06 01:24:45.667327903 -0400
+++ nagios-1.3-cvs.20050402/xdata/xrddb.c	2005-06-03 12:48:28.906839644 -0400
@@ -641,7 +641,7 @@
 			snprintf(buffer,sizeof(buffer)-1,"Error: Could not insert retention data for host '%s' in table '%s'\n",host_name,XRDDB_HOSTRETENTION_TABLE);
-			continue;
+			return ERROR;
@@ -738,7 +738,7 @@
 			snprintf(buffer,sizeof(buffer)-1,"Error: Could not insert retention data for service '%s' on host '%s' in table '%s'\n",service_description,host_name,XRDDB_SERVICERETENTION_TABLE);
-			continue;
+			return ERROR;