monit 5.17 segfaults

Issue #331 resolved
Former user created an issue

same config - same build script - 5.16 without problems - 5.17 segfaults after pause:

[root@pie2 monit]# /opt/monit/bin/monit -I -s /etc/monit.state -c /etc/monitrc
Starting Monit 5.17 daemon with http interface at [localhost]:2812
Monit start delay set -- pause for 30s
Segmentation fault

Comments (9)

  1. Tildeslash repo owner

    Please can you get a coredump and send backtrace?:

    gdb /opt/monit/bin/monit
    (gdb) run -I -s /etc/monit.state -c /etc/monitrc
    ... when monit will crash:
    (gdb) thr apply all bt
    
  2. Axel Reinhold
    [root@bongo opt]# gdb /opt/monit/bin/monit
    GNU gdb Red Hat Linux (5.2.1-4)
    Copyright 2002 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "i386-redhat-linux"...
    (no debugging symbols found)...
    (gdb) run -I -s /etc/monit.state -c /etc/monitrc
    Starting program: /mnt/opt/monit-5.17-2/bin/monit -I -s /etc/monit.state -c /etc/monitrc
    [New Thread 16384 (LWP 3578)]
     New Monit id: fb90e24fc273c043419db71810eb735e
     Stored in '/root/.monit.id'
    Starting Monit 5.17 daemon with http interface at [bongo]:2812
    [New Thread 32769 (LWP 3586)]
    [New Thread 16386 (LWP 3587)]
    
    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 16384 (LWP 3578)]
    0x0806f057 in Util_replaceString ()
    (gdb) thr apply all bt
    
    Thread 3 (Thread 16386 (LWP 3587)):
    #0  0xb7c83226 in __poll (fds=0xb7cdece0, nfds=1, timeout=1000)
        at ../sysdeps/unix/sysv/linux/poll.c:86
    #1  0x08095198 in Net_canRead ()
    #2  0x08085f07 in init_service ()
    #3  0x080861c4 in Engine_start ()
    #4  0x08065950 in monit_http ()
    #5  0xb7f02972 in pthread_start_thread_event (arg=0x7) at manager.c:304
    
    Thread 2 (Thread 32769 (LWP 3586)):
    #0  0xb7c83226 in __poll (fds=0xb7cdece0, nfds=1, timeout=2000)
        at ../sysdeps/unix/sysv/linux/poll.c:86
    #1  0xb7f01c5f in __pthread_manager (arg=0x7d0) at manager.c:146
    #2  0xb7f01e19 in __pthread_manager_event () at manager.c:243
    
    Thread 1 (Thread 16384 (LWP 3578)):
    #0  0x0806f057 in Util_replaceString ()
    #1  0x0805e2c4 in main ()
    #2  0x0805ee8c in handle_alert ()
    #3  0x080610f3 in Event_get_action ()
    #4  0x0806191b in Event_post ()
    #5  0x0805da97 in main ()
    ---Type <return> to continue, or q <return> to quit---
    #6  0xb7bd3bc1 in __libc_start_main (main=0x805d170 <main>, argc=6, 
        ubp_av=0xbfb116f4, init=0x809f7cc <__libc_csu_init>, 
        fini=0xb7f92020 <_rtld_local>, rtld_fini=0, stack_end=0xbfb116ec)
        at ../sysdeps/generic/libc-start.c:227
    (gdb) quit
    The program is running.  Exit anyway? (y or n) y
    
  3. Tildeslash repo owner

    Thanks for data, please can you yet send the "set mail-format" settings from your configuration file to support@tildeslash.com?

  4. Tildeslash repo owner

    The problem should be fixed, it occurs if no mail-format is defined. You can workaround the issue by adding the following statement:

    set mail-format { from: monit@$HOST }
    

    You can also compile the fixed version from the git repository (we'll release it as 5.17.1 early next week):

    wget https://bitbucket.org/tildeslash/monit/get/master.tar.gz
    tar -xzf master.tar.gz
    cd tildeslash-* 
    ./bootstrap
    ./configure
    make
    
  5. anastrophe

    Hey there, I presume this bug only triggers if you do not have the mail-format configured, and you are sending alerts via email? My alerts are triggered to pagerduty, and I've not experienced any issues since upgrade to 5.17.

  6. Tildeslash repo owner

    @anastrophe : yes, the problem is related only to configurations, where mail alert is enabled ("set mailserver ..." and "set alert ..."is set, but no "set mail-format" with "from:" option is present). Configurations which use the exec action to deliver alerts were not affected.

    Monit 5.17.1 which fixes the problem crash was released yesterday.

  7. Log in to comment