monit dies with "raised in StringBuffer_free at src/util/StringBuffer.c:103"

Issue #519 resolved
Fabrizio Magni created an issue

On monit 5.16 we get:

raised in StringBuffer_free at src/util/StringBuffer.c:103

when monit try to restart our tomcat after it detects a "java.lang.OutOfMemoryError" in catalina.out.

If I comment:

#       if match "java.lang.OutOfMemoryError" then restart

then monit is able to start properly.

Comments (7)

  1. Fabrizio Magni reporter

    On monit 5.20 I get: [CET Dec 10 15:21:34] critical : AssertException: S && *S raised in StringBuffer_free at src/util/StringBuffer.c:107

  2. Tildeslash repo owner

    Fixed: Issue #519: Monit may crash if the file check with a restart action on content match is used and this file has some dependant services at the same time.

    Backtrace with hardware watchdog on ml->log:

    (gdb) c Continuing.

    Thread 1 "monit" hit Hardware watchpoint 3: *$2

    Old value = { used = 36, length = 512, buffer = 0x0, compressedBuffer = 0x0 } New value = { used = 1325400066, length = 512, buffer = 0x0, compressedBuffer = 0x0 } 0x00007ffff75ba95e in ?? () from /lib/x86_64-linux-gnu/libasan.so.5 (gdb) bt #0 0x00007ffff75ba95e in ?? () from /lib/x86_64-linux-gnu/libasan.so.5 #1 0x00007ffff769b799 in free () from /lib/x86_64-linux-gnu/libasan.so.5 #2 0x000055555591f0b8 in StringBuffer_free (S=0x606000000c40) at src/util/StringBuffer.c:111 #3 0x0000555555859a38 in _checkMatch (s=0x616000001280) at src/validate.c:1169 #4 check_file (s=0x616000001280) at src/validate.c:1705 #5 0x00005555557cf89f in _check (s=0x616000001280) at src/control.c:201 #6 _doStart (s=s@entry=0x616000000380) at src/control.c:231 #7 0x00005555557d0a58 in _doDepend (s=s@entry=0x616000001280, action=action@entry=Action_Start, unmonitor=unmonitor@entry=false) at src/control.c:389 #8 0x00005555557d15ef in control_service (S=<optimized out>, A=A@entry=Action_Restart) at src/control.c:481 #9 0x00005555557d3f35 in _handleAction (E=0x6070000005d0, A=<optimized out>) at src/event.c:329 #10 0x00005555557d5a55 in _handleEvent (E=0x6070000005d0, S=0x616000001280) at src/event.c:381 #11 Event_post (service=0x616000001280, id=<optimized out>, state=<optimized out>, action=<optimized out>, s=<optimized out>) at src/event.c:459 #12 0x00005555558599db in _checkMatch (s=0x616000001280) at src/validate.c:1167 #13 check_file (s=0x616000001280) at src/validate.c:1705 #14 0x000055555584befd in validate () at src/validate.c:1502 #15 0x0000555555785edd in do_default () at src/monit.c:588 #16 do_action (arguments=0x603000000280) at src/monit.c:417 #17 main (argc=<optimized out>, argv=<optimized out>) at src/monit.c:175 (gdb) c Continuing. 'dependant' start: '/usr/bin/true' [Detaching after vfork from child process 1119186] 'dependant' failed to start (exit status 0) -- no output

    DEBUG: ml->log=(nil) -- before StringBuffer_free AssertException: S && *S raised in StringBuffer_free at src/util/StringBuffer.c:108

    Thread 1 "monit" received signal SIGABRT, Aborted. GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007ffff650e859 in GI_abort () at abort.c:79 #2 0x0000555555781138 in vLogAbortHandler (s=0x5555559b4960 "%s: %s\n raised in %s at %s:%d\n", ap=<optimized out>) at src/log.c:334 #3 0x00005555559178cc in System_abort (e=e@entry=0x5555559b4960 "%s: %s\n raised in %s at %s:%d\n") at src/system/System.c:78 #4 0x00005555559070f6 in Exception_throw (e=0x555555bfb0e0 <AssertException>, func=func@entry=0x5555559b8600 <func__.6022> "StringBuffer_free", file=file@entry=0x5555559b8040 "src/util/StringBuffer.c", line=line@entry=108, cause=cause@entry=0x5555559b80c0 "S && *S") at src/exceptions/Exception.c:104 #5 0x000055555591f118 in StringBuffer_free (S=0x606000000c40) at src/util/StringBuffer.c:111 #6 0x0000555555859a38 in _checkMatch (s=0x616000001280) at src/validate.c:1169 #7 check_file (s=0x616000001280) at src/validate.c:1705 #8 0x000055555584befd in validate () at src/validate.c:1502 #9 0x0000555555785edd in do_default () at src/monit.c:588 #10 do_action (arguments=0x603000000280) at src/monit.c:417 #11 main (argc=<optimized out>, argv=<optimized out>) at src/monit.c:175

    → <<cset a2713ac76cc4>>

  3. Log in to comment