monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit] Floating point exception in monit 4.10.1


From: Stanislav Meduna
Subject: [monit] Floating point exception in monit 4.10.1
Date: Mon, 04 Aug 2008 14:13:20 +0200
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

Hi,

monit 4.10.1 crashes with a floating point exception at

#0  0x08053f22 in initprocesstree (pt_r=0x809791c, size_r=0x8097920,
    oldpt_r=0x8097924, oldsize_r=0x8097928) at process.c:317
#1  0x08061094 in validate () at validate.c:144

where in the

317             if(pt[i].cpu_percent > 1000 / num_cpus)

the num_cpus is zero. The reason is that the sysconf call

  if((num_cpus = sysconf(_SC_NPROCESSORS_CONF)) == -1)

in the process/sysdep_LINUX.c returns zero.

The OS is a user-mode linux, kernel version 2.6.26:

Linux dirk 2.6.26 #1 Wed Jul 30 10:56:10 CEST 2008 i686 GNU/Linux

The /proc/cpuinfo reports

processor       : 0
vendor_id       : User Mode Linux
model name      : UML
mode            : skas
host            : Linux seldon-base 2.6.23.17 #2 SMP Sat Jun 21 15:04:22 CEST 
2008 i686
bogomips        : 4771.02


I don't know who exactly is reporting a nonsense here (kernel
in general, UML or glibc), but thinking in defensive programming
I'd suggest the following patch:

--- process/sysdep_LINUX.c.orig 2008-08-04 13:54:16.000000000 +0200
+++ process/sysdep_LINUX.c      2008-08-04 13:55:48.000000000 +0200
@@ -141,6 +141,12 @@
     return FALSE;
   }

+  if (num_cpus < 1)
+  {
+    DEBUG("num_cpus reported as %d on your system, setting 1\n", num_cpus);
+    num_cpus = 1;
+  }
+


On my system this fixes the crash.

Regards
--
                                            Stano





reply via email to

[Prev in Thread] Current Thread [Next in Thread]