incron icon indicating copy to clipboard operation
incron copied to clipboard

Consistent segmentation faults upon creating directories

Open GSI opened this issue 8 years ago • 5 comments

I can consistently crash incrond 0.5.12 with a single mkdir command.

incrontab:

/tmp/i IN_CREATE echo $@/$# $%

Journal output upon mkdir /tmp/i/del:

incrond[13604]: PATH (/tmp/i) FILE (del) EVENT (IN_CREATE,IN_ISDIR)
systemd[1]: incrond.service: Main process exited, code=dumped, status=11/SEGV
systemd[1]: incrond.service: Unit entered failed state.
systemd[1]: incrond.service: Failed with result 'core-dump'.

Backtrace:

(gdb) bt
#0  0x00007f07242bc3e8 in memchr () from /usr/lib/libc.so.6
#1  0x00007f07249138aa in std::char_traits<char>::find (__a=<synthetic pointer>: <optimized out>, __n=<optimized out>,
    __s=<optimized out>) at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:274
#2  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find (this=<optimized out>, __c=<optimized out>,
    __pos=<optimized out>) at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:1209
#3  0x000000000040fd71 in ?? ()
#4  0x000000000041060e in ?? ()
#5  0x0000000000404412 in ?? ()
#6  0x00007f0724259291 in __libc_start_main () from /usr/lib/libc.so.6
#7  0x0000000000405249 in ?? ()

Observations:

  • File creation (touch) does not cause the issue. Only directories;
  • When leaving out the $@, the command runs just fine (/tmp/i IN_CREATE echo /$# $%)
  • I confirmed the behaviour on tmpfs and ext4.

GSI avatar Feb 01 '17 20:02 GSI

Could you build the daemon with -O0 -g flags and reproduce the problem? The gdb stack should be much nicer then...

UnitedMarsupials-zz avatar Nov 14 '17 02:11 UnitedMarsupials-zz

This is a very consistent bug -- and @GSI provided exact steps to reproduce it. Unfortunately, an year later this issue is still open and is biting people who are trying to use incrond.

The bug is between lines usertable.cpp#L390 and usertable.cpp#L408 where incrond "forgets" and reloads itself, then tries to process an event it just forgot about :)

galaxy4public avatar Mar 03 '18 14:03 galaxy4public

I have 0.5.12 too on a centos 7, same behaviour,moreover sometimes a huge number of incrond processes appear which freezes the system (load1 up to 2000!), with a lot of messages like these:

auditd[766]: dispatch error reporting limit reached - ending report notification. auditd[766]: dispatch err (pipe full) event lost

Thank you.

frayber avatar Mar 08 '19 11:03 frayber

hi guys, i am same problem, is incron stiil in development? This bug is a big bug... can someone investigate and solve please? I am on ubuntu server 20.04 and incron 5.12

Nikoh77 avatar Jan 03 '21 19:01 Nikoh77

Same problem, on verion 0.5.12. Anyone reading this and cannot wait for @ar- to work on this:

checkout this commit from @galaxy4public https://github.com/galaxy4public/incron/commit/134900ea1dd19834ba6e6c7e7e07611a0e0d78a0

make & make install
cp incrond /usr/sbin/incrond

patricksebastien avatar Feb 15 '23 22:02 patricksebastien