rsyslog icon indicating copy to clipboard operation
rsyslog copied to clipboard

ruleset with queue.type="direct" hitting memory leaks when we kill rsyslogd

Open wltu opened this issue 1 year ago • 0 comments

Expected behavior

When killing the rsyslogd, it shouldn't have memory leaks.

Actual behavior

ASAN hitting memory leaks.

Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0xa69c95d4 in __interceptor_calloc (/usr/lib/libasan.so.8+0xd85d4) (BuildId: ee0b8a590de2b6d96c2138cdebb2499a90e6a07a)
    #1 0x543808 in wtiConstruct (/tmp/rsyslogd+0x109808) (BuildId: caebfd4ef706b2a935107dacec32d0c878771e51)
    #2 0x5462a8 in wtiGetDummy (/tmp/rsyslogd+0x10c2a8) (BuildId: caebfd4ef706b2a935107dacec32d0c878771e51)
    #3 0x54dc10  (/tmp/rsyslogd+0x113c10) (BuildId: caebfd4ef706b2a935107dacec32d0c878771e51)
    #4 0x54993c  (/tmp/rsyslogd+0x10f93c) (BuildId: caebfd4ef706b2a935107dacec32d0c878771e51)
    #5 0x555dbc in qqueueEnqMsg (/tmp/rsyslogd+0x11bdbc) (BuildId: caebfd4ef706b2a935107dacec32d0c878771e51)
    #6 0x46dfd4 in submitMsg2 (/tmp/rsyslogd+0x33fd4) (BuildId: caebfd4ef706b2a935107dacec32d0c878771e51)
    #7 0x5668b4 in ratelimitAddMsg (/tmp/rsyslogd+0x12c8b4) (BuildId: caebfd4ef706b2a935107dacec32d0c878771e51)
    #8 0xa610bfa8  (/usr/lib/libm.so.6+0x6fa8)
    #9 0x580fbc  (/tmp/rsyslogd+0x146fbc) (BuildId: caebfd4ef706b2a935107dacec32d0c878771e51)

Direct leak of 42 byte(s) in 3 object(s) allocated from:
    #0 0xa69c9a44 in __interceptor_malloc (/usr/lib/libasan.so.8+0xd8a44) (BuildId: ee0b8a590de2b6d96c2138cdebb2499a90e6a07a)
    #1 0xa68731d0 in es_str2cstr (/lib/libestr.so.0+0x11d0) (BuildId: 2b1b1012f05508f6f53407c3ee9f8becffb3eda4)

Steps to reproduce the behavior

  • rsyslog.conf
ruleset(name="test-rule" queue.type="direct"){
  action(type="omfile" dirCreateMode="0700" FileCreateMode="0644" File="/tmp/log/messages")
}

input(type="imfile" file="/tmp/test*.log" tag="test:" ruleset="test-rule")
  • Generate some logs to make sure that we are sending some logs.
echo "test" >> /tmp/test.log
  • Kill rsyslog
kill $(pidof rsyslog)

Environment

  • rsyslog version:
rsyslogd -v
rsyslogd  8.2306.0 (aka 2023.06) compiled with:
        PLATFORM:                               arm-openbmc-linux-gnueabi
        PLATFORM (lsb_release -d):
        FEATURE_REGEXP:                         Yes
        GSSAPI Kerberos 5 support:              No
        FEATURE_DEBUG (debug build, slow code): No
        32bit Atomic operations supported:      Yes
        64bit Atomic operations supported:      No
        memory allocator:                       system default
        Runtime Instrumentation (slow code):    No
        uuid support:                           Yes
        systemd support:                        Yes
        Config file:                            /etc/rsyslog.conf
        PID file:                               /var/run/rsyslogd.pid
        Number of Bits in RainerScript integers: 64

See https://www.rsyslog.com for more information.
  • platform:
uname -a
Linux $HOSTNAME 5.15.120-yocto-s-dirty-efd7cc7 #1 SMP Wed Sep 11 01:04:58 UTC 2024 armv7l GNU/Linux

wltu avatar Oct 17 '24 01:10 wltu