generic protocol malloc error

Issue #632 closed
Andreas created an issue

I try to check CUPS printer via IPP using the GENERIC protocol.

my monitrc (relevant parts) :

set limits {                                                                                
    sendExpectBuffer: 8 kB,
check process HP_Deskjet
    match "/usr/sbin/cupsd"
    if failed unixsocket /var/run/cups/cups.sock
        send "POST /printers/HP_Deskjet HTTP/1.1\r\n"
        send "Content-Length: 123\r\n"
        send "Content-Type: application/ipp\r\n"
        send "Authorization: PeerCred root\r\n"
        send "\r\n"
        send "\0x01\0x01\0x00\0x0B\0x11\0x12\0x13\0x14\0x01\0x47\0x00\0x12attributes-charset\0x00\0x05utf-8H\0x00\0x1Battributes-natural-language\0x00\0x02en\0x45\0x00\0x0Bprinter-uri\0x00\0x23ipp://localhost/printers/HP_Deskjet\0x03"
        expect "printer-is-accepting-jobs[\\]0^A^A.*printer-state[\\]0^D[\\]0[\\]0[\\]0[^^E].*printer-state-message[\\]0[\\]0.*printer-state-reasons[\\]0^Dnone"
        then alert

(^A = char 0x01, ^D = char 0x04)

monit gets SIGABRT right after the following error:

monit: malloc.c:4660: _int_malloc: Assertion `(unsigned long)(size) >= (unsigned long)(nb)' failed.

#0  0xb7fe1428 in __kernel_vsyscall ()
#1  0xb7bbc6c1 in raise () from /lib/i386-linux-gnu/i686/cmov/
#2  0xb7bbfaf2 in abort () from /lib/i386-linux-gnu/i686/cmov/
#3  0xb7c02144 in ?? () from /lib/i386-linux-gnu/i686/cmov/
#4  0xb7c04cd9 in ?? () from /lib/i386-linux-gnu/i686/cmov/
#5  0xb7c060cb in calloc () from /lib/i386-linux-gnu/i686/cmov/
#6  0xb7c4f193 in ?? () from /lib/i386-linux-gnu/i686/cmov/
#7  0xb7c5105d in ?? () from /lib/i386-linux-gnu/i686/cmov/
#8  0xb7c51358 in regexec () from /lib/i386-linux-gnu/i686/cmov/
#9  0x08094bcc in check_generic ()
#10 0x0806f3b4 in _testUnix ()
#11 0x080708ea in Socket_test ()
#12 0x0807b1f1 in _checkConnection ()
#13 0x0807c2e1 in check_process ()
#14 0x0807bf1e in validate ()
#15 0x080539e4 in main () 

it's 5.20. it does not occour with 5.19.

Comments (3)

  1. Tildeslash repo owner


    we're unable to reproduce the issue. The malloc assert comes from regexec() internal allocation, not from monit itself. It could be bug in regex itself (maybe after some regex update?)

    Please can you provide more informations?:

    1.) Which linux platform and version it exactly is? + output of "uname -a"

    2.) Please can you retest on the same system the following Monit releases?:

    Monit 5.19.0 (so we can be sure it is tested with the same regex version)
    Monit 5.23.0 (latest monit release)

    3.) Please switch the test from unixsocket to localhost:631, run monit again and collect network trace of the communication between Monit and the cups daemon (you can use for example tcpdump or wireshark) and send it to

    4.) If monit will crash during the test, please can you send monit coredump to

  2. Log in to comment