vstakhov / rmilter

Another sendmail milter for different mail checks.
86 stars 18 forks source link

Rmilter bug Redis #118

Closed andypl78 closed 8 years ago

andypl78 commented 8 years ago

By setting the variables other than

servers_limits = localhost;

example servers_limits = 10.10.10.10;

we get an error in the syslog

kernel: [ 2850.426887] rmilter[16603]: segfault at b2 ip 000000000040cf85 sp 00007fa36903fb40 error 4 in rmilter[400000+5a000]

Testing on stable rmilter 1.8.5 and 1.8.6 System: Debian Jessie Redis: redis sentinel

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

vstakhov commented 8 years ago

Could you please get a core file for this bug? https://rspamd.com/doc/faq.html#how-to-figure-out-why-rspamd-process-crashed

andypl78 commented 8 years ago

where do I send a file of about 53 MB?

vstakhov commented 8 years ago

https://rspamd.com/doc/faq.html#what-can-i-do-with-core-files

andypl78 commented 8 years ago

gdb which rmilter -c /coreland/rmilter.core.23940 Excess command line arguments ignored. (rmilter) GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... "/usr/bin/which": not in executable format: File format not recognized [New LWP 23945] [New LWP 23940] [New LWP 23944] [New LWP 23941] [New LWP 23942] [New LWP 23943] Core was generated by `/usr/sbin/rmilter -c /etc/rmilter.conf -n'. Program terminated with signal SIGABRT, Aborted.

0 0x00007f38458e2067 in ?? ()

vstakhov commented 8 years ago
gdb `which rmilter` -c /coreland/rmilter.core.23940
andypl78 commented 8 years ago

gdb which rmilter -c /coreland/rmilter.core.23940 GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/sbin/rmilter...done. [New LWP 23945] [New LWP 23940] [New LWP 23944] [New LWP 23941] [New LWP 23942] [New LWP 23943] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/usr/sbin/rmilter -c /etc/rmilter.conf -n'. Program terminated with signal SIGABRT, Aborted.

0 0x00007f38458e2067 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56

56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.

vstakhov commented 8 years ago

And now bt full output please.

andypl78 commented 8 years ago

I changed the IP addresses and e-mail

0 0x00007f38458e2067 in **GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56

    resultvar = 0
    pid = 23940
    selftid = 23945

1 0x00007f38458e3448 in __GI_abort () at abort.c:89

    save_stage = 2
    act = {__sigaction_handler = {sa_handler = 0x7f3830000f2d, sa_sigaction = 0x7f3830000f2d}, sa_mask = {__val = {139879300206381, 18446744073709551615, 4513595, 139879455525080, 1, 139879455524768, 139879662630056, 25697288193, 139879300206381, 139879300206381,
          139879300206381, 139879300206381, 139879300206386, 18446744073709551615, 139879300206381, 18446744073709551615}}, sa_flags = 0, sa_restorer = 0x0}
    sigs = {__val = {32, 0 <repeats 15 times>}}

2 0x00007f38459201b4 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7f3845a15530 "* Error in `%s': %s: 0x%s *\n") at ../sysdeps/posix/libc_fatal.c:175

    ap = {{gp_offset = 40, fp_offset = 0, overflow_arg_area = 0x7f3839420a80, reg_save_area = 0x7f3839420a10}}
    fd = 2
    on_2 = <optimized out>
    list = <optimized out>
    nlist = <optimized out>
    cp = <optimized out>
    written = <optimized out>

3 0x00007f384592598e in malloc_printerr (action=1, str=0x7f3845a11646 "free(): invalid pointer", ptr=) at malloc.c:4996

    buf = "00007f3839420ca0"
    cp = <optimized out>

4 0x00007f3845926696 in _int_free (av=, p=, have_lock=0) at malloc.c:3840

    size = <optimized out>
    fb = <optimized out>
    nextchunk = <optimized out>
    nextsize = <optimized out>
    nextinuse = <optimized out>
    prevsize = <optimized out>
    bck = <optimized out>
    fwd = <optimized out>
    errstr = <optimized out>
    locked = <optimized out>
    __func** = "_int_free"

5 0x000000000040cf99 in rmilter_query_cache (cfg=0x1118030, type=23945, key=0x7f3839420bf0 "as@example.domain2:91.X.X.X:as@example.domain", keylen=0, data=0x3061633032343933, datalen=0x0, priv=0x7f3839420ca0) at /rmilter-1.8.6/src/cache.c:213

    serv = 0x1119ab8
    redis = 0x7f3830000b80
    r = 0x7f3839420ca0
    rep = 960629920

6 0x0000000000418237 in check_specific_limit (priv=0x7f382c0023c0, cfg=0x1118030, type=6, type@entry=TO_IP_FROM, bucket=0x111c0e0, tm=-nan(0xfffff00000000), tm@entry=1464897365.409344,

rcpt=0x3061633032343933 <error: Cannot access memory at address 0x3061633032343933>, rcpt@entry=0x7f3830000a10 "as@example.domain2", is_update=0) at /rmilter-1.8.6/src/ratelimit.c:166
    b = 0x7f3839420d30
    key = "as@example.domain2:91.X.X.X:as@example.domain\000\000\000\000\005", '\000' <repeats 15 times>, "\001\000\000\000\000\000\000\000\250\241\226F8\177", '\000' <repeats 43 times>, "\245\226F8\177\000\000\240\fB98\177\000\000\220\fB98\177\000\000\324\000\327\032\000\000\000\000\035C@\000\000\000\000\000\377\377\377\377", '\000' <repeats 12 times>, "\004\000\000\000\070\177\000\000`\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"...
    dlen = 16

7 0x000000000041868c in check_specific_limit (is_update=0, rcpt=0x7f3830000a10 "as@example.domain2", tm=1464897365.409344, bucket=0x111c0e0, type=TO_IP_FROM, cfg=0x1118030, priv=0x7f382c0023c0) at /rmilter-1.8.6/src/ratelimit.c:251

No locals.

8 rate_check (priv=priv@entry=0x7f382c0023c0, cfg=0x1118030, rcpt=rcpt@entry=0x7f3830000a10 "as@example.domain2", is_update=is_update@entry=0) at /rmilter-1.8.6/src/ratelimit.c:251

    t = 1464897365.409344
    tm = <optimized out>

9 0x000000000041ba3f in mlfi_envrcpt (ctx=0x1129f80, envrcpt=) at /rmilter-1.8.6/src/rmilter.c:955

    priv = 0x7f382c0023c0
    act = <optimized out>
    newrcpt = 0x7f3830000a10
    tmprcpt = 0x7f38300009b0 "as@example.domain2"

10 0x00007f38462cef35 in ?? () from /usr/lib/x86_64-linux-gnu/libmilter.so.1.0.1

No symbol table info available.

11 0x00007f38462ceb5b in mi_engine () from /usr/lib/x86_64-linux-gnu/libmilter.so.1.0.1

No symbol table info available.

12 0x00007f38462d1276 in ?? () from /usr/lib/x86_64-linux-gnu/libmilter.so.1.0.1

No symbol table info available.

13 0x00007f3845c600a4 in start_thread (arg=0x7f3839421700) at pthread_create.c:309

    __res = <optimized out>
    pd = 0x7f3839421700
    now = <optimized out>
    unwind_buf = {cancel_jmp_buf = {{jmp_buf = {139879455528704, -7230084128774932731, 0, 139879679168608, 0, 139879455528704, 7339150293653665541, 7338931455985465093}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0,
          canceltype = 0}}}
    not_first_call = <optimized out>
    pagesize_m1 = <optimized out>
    sp = <optimized out>
    freesize = <optimized out>
    __PRETTY_FUNCTION__ = "start_thread"

14 0x00007f384599587d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

andypl78 commented 8 years ago

I know where the problem was. Rmilter could not connect with Redis but Rmilter should save the error logs connections to Redis and do crash.