Monit 5.22 segfault

Issue #614 resolved
Former user created an issue

trace:

Program received signal SIGSEGV, Segmentation fault.
0x000000000042b9a9 in _checkProcessResources ()
(gdb) thr apply all bt

Thread 2 (Thread 0x7ffff6228700 (LWP 2811)):
#0  0x00007ffff6b5e84d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x000000000043c110 in Engine_start ()
#2  0x000000000041c7e2 in thread_wrapper ()
#3  0x00007ffff74ac184 in start_thread (arg=0x7ffff6228700) at pthread_create.c:312
#4  0x00007ffff6b6bbed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7ffff7fec740 (LWP 2803)):
#0  0x000000000042b9a9 in _checkProcessResources ()
#1  0x000000000042dbc2 in check_system ()
#2  0x000000000042d65a in validate ()
#3  0x0000000000413548 in do_action ()
#4  0x00000000004142c1 in main ()

Comments (16)

  1. Tildeslash repo owner

    you need to enable coredumps first:

    ulimit -c unlimited
    

    then start monit in the same console ... when monit will crash, the coredump will be saved either to current directory or global coredump directory such as /var/crash/core (depends on your sysctl kernel.core_pattern settings)

  2. Tildeslash repo owner

    The problem is triggered by the "totalmem" statement in the context of "system" service:

    check system $HOST
        ....
        if totalmem > 90% for 30 cycles then alert
    

    The "totalmem" test is for "process" service types only (it checks the total memory usage of the process and its children). It shouldn't work in the context of the "system" check ... will fix the configuration parser.

    Please replace the "totalmem" test in the "check system" context with "memory" test:

        if memory usage > 90% for 30 cycles then alert
    
  3. Tildeslash repo owner

    in 5.20.0 it doesn't crash, but the test doesn't work too, as the "totalmem" test cannot be performed (no data in check system context)

  4. Tildeslash repo owner

    Fixed: Issue #614: Monit may crash if "total memory" test is used in "check system" context. The "total memory" test is for process checks only (includes children memory total) and will produce syntax error if used in system check now.

    → <<cset 692514c5f207>>

  5. Log in to comment