Akito
March 29, 2022, 3:31pm
21
Indeed. To be sure, one should test an extreme case, like 10 minutes for example, and then you can be sure. 60 was too low, to be absolutely sure.
Skimming through the list of issues, I found the following one.
opened 11:34PM - 30 May 18 UTC
Hello,
We have noticed an issuing using incron on a NFS mounted file system. … I have noticed that incrond and the nfs-client.target start at the same time and if incrond starts before the nfs-client, nfs services are not monitored for file system changes and inotify then doesn't monitor the filesystem.
12:05:18] root@test-box-01
/etc/systemd/system# systemctl status nfs-client.target
● nfs-client.target - NFS client services
Loaded: loaded (/usr/lib/systemd/system/nfs-client.target; enabled; vendor preset: disabled)
Active: active since Fri 2018-05-25 12:21:25 AEST; 3 days ago
May 25 12:21:25 test-box-01.creditlink.com.au systemd[1]: Reached target NFS client services.
May 25 12:21:25 test-box-01.creditlink.com.au systemd[1]: Starting NFS client services.
● incrond.service - Inotify System Scheduler
Loaded: loaded (/usr/lib/systemd/system/incrond.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-05-25 12:21:25 AEST; 3 days ago
Main PID: 689 (incrond)
CGroup: /system.slice/incrond.service
└─689 /usr/sbin/incrond
May 25 12:21:25 test-box-01.creditlink.com.au systemd[1]: Starting Inotify System Scheduler...
May 25 12:21:25 test-box-01.creditlink.com.au incrond[677]: starting service (version 0.5.10, built on Sep 24 2014 19:02:26)
May 25 12:21:25 test-box-01.creditlink.com.au incrond[689]: loading system tables
May 25 12:21:25 test-box-01.creditlink.com.au incrond[689]: loading user tables
May 25 12:21:25 test-box-01.creditlink.com.au incrond[689]: loading table for user wasadmin
May 25 12:21:25 test-box-01.creditlink.com.au incrond[689]: ready to process filesystem events
May 25 12:21:25 test-box-01.creditlink.com.au systemd[1]: Started Inotify System Scheduler.
Version-Release number of selected component (if applicable):
nfs-utils-1.3.0-0.54.el7.x86_64
incron-0.5.10-8.el7.x86_64
Steps to Reproduce:
incrontab entry:
/import IN_CLOSE_WRITE /root/bin/test.sh $@/$#
Script contents
/root/bin# cat /root/bin/test.sh
#!/bin/bash
filename=$1
echo "$(date) Found File: $1" >> /tmp/test.junk 2>&1
Incron Running once loaded after NFS
[13:18:26] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
[13:18:28] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
[13:18:29] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
[13:18:30] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
[13:18:30] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
[13:18:32] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
Incron log entries:
2018-05-29T13:18:01.602113+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/test.junk)
2018-05-29T13:18:28.975097+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/test.junk)
2018-05-29T13:18:29.981485+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/test.junk)
2018-05-29T13:18:30.484573+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/test.junk)
2018-05-29T13:18:30.987448+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/test.junk)
2018-05-29T13:18:32.297748+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/test.junk)
2018-05-29T13:18:33.708373+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/test.junk)
Umount and remount NFS Share
[13:22:57] root@test-box-02
/root/bin# umount /import/
[13:23:06] root@test-box-02
/root/bin# mount /import/
Run test messages again
/root/bin# echo "This is a test file" > /import/test.junk
[13:23:38] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
[13:23:39] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
Log file not updated
2018-05-29T13:18:33.708373+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/test.junk)
2018-05-29T13:18:52.758378+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/)
2018-05-29T13:18:52.758589+10:00 test-box-02 incrond[28133]: (root) CMD (/root/bin/test.sh /import/)
Entries from 13:23:37,38,39 not included in file
/root/bin# cat /tmp/test.junk
Found File: /import/test.junk
Tue May 29 13:18:28 AEST 2018 Found File: /import/test.junk
Tue May 29 13:18:29 AEST 2018 Found File: /import/test.junk
Tue May 29 13:18:30 AEST 2018 Found File: /import/test.junk
Tue May 29 13:18:30 AEST 2018 Found File: /import/test.junk
Tue May 29 13:18:32 AEST 2018 Found File: /import/test.junk
Tue May 29 13:18:33 AEST 2018 Found File: /import/test.junk
Tue May 29 13:18:52 AEST 2018 Found File: /import/
Tue May 29 13:18:52 AEST 2018 Found File: /import/
[13:24:08] root@test-box-02
Restart incrond
[13:24:58] root@test-box-02
/root/bin# systemctl restart incrond
[13:25:20] root@test-box-02
/root/bin# systemctl status incrond
● incrond.service - Inotify System Scheduler
Loaded: loaded (/usr/lib/systemd/system/incrond.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2018-05-29 13:25:09 AEST; 13s ago
Process: 29263 ExecStart=/usr/sbin/incrond (code=exited, status=0/SUCCESS)
Main PID: 29264 (incrond)
CGroup: /system.slice/incrond.service
└─29264 /usr/sbin/incrond
2018-05-29T13:25:09.599421+10:00 test-box-02 incrond[28133]: stopping service
2018-05-29T13:25:09.608714+10:00 test-box-02 incrond[29263]: starting service (version 0.5.10, built on Sep 24 2014 19:02:26)
2018-05-29T13:25:09.613623+10:00 test-box-02 incrond[29264]: loading system tables
2018-05-29T13:25:09.613880+10:00 test-box-02 incrond[29264]: loading user tables
2018-05-29T13:25:09.614776+10:00 test-box-02 incrond[29264]: loading table for user spuser
2018-05-29T13:25:09.615332+10:00 test-box-02 incrond[29264]: loading table for user root
2018-05-29T13:25:09.617126+10:00 test-box-02 incrond[29264]: ready to process filesystem events
Send test messages:
[13:25:23] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
[13:25:32] root@test-box-02
/root/bin# echo "This is a test file" > /import/test.junk
Log file
2018-05-29T13:25:32.045328+10:00 test-box-02 incrond[29264]: (root) CMD (/root/bin/test.sh /import/test.junk)
2018-05-29T13:25:33.552584+10:00 test-box-02 incrond[29264]: (root) CMD (/root/bin/test.sh /import/test.junk)
File has new entries:
Tue May 29 13:25:32 AEST 2018 Found File: /import/test.junk
Tue May 29 13:25:33 AEST 2018 Found File: /import/test.junk
I suspect that if there is dependency placed on incrond to wait for nfs-client this will probably go away.
At least a bit similar to this one.
Unfortunately, this software wasn’t touched since 2017 and it shows:
opened 08:59PM - 01 Feb 17 UTC
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**.
So, if you find a real bug in it, you cannot expect it to be fixed any time soon.
1 Like
Rosika
(Rosika Schreck)
March 30, 2022, 11:28am
22
Hi @Akito ,
thanks for the links . I´ve read them through and realized the people there were using version 0.5.12. My version is “0.5.12-2build1” as well.
I´m pretty amazed that (like you pointed out) there´s never been a new version for quite a long time.
Akito:
Indeed. To be sure, one should test an extreme case, like 10 minutes for example, and then you can be sure. 60 was too low, to be absolutely sure.
Right. But the 500 secs. yielded good results. I checked again today.
By that time anything which would prove to be relevant for incron seems to have been loaded.
Many greetings
Rosika
Akito
March 30, 2022, 11:41am
23
Great to see positive progress.
Cannot wait for the next stones on the road of your next adventure…
1 Like
Rosika
(Rosika Schreck)
March 30, 2022, 12:31pm
24
Thanks so much @Akito for your continued help.
It´s so good of you to take a substantial amount of time out of your day in order to help me (and others as well of course ).
Plus: your expertise is highly appreciated and provides an integral part of support and assistance within this forum.
Thanks a lot.
Many greetings from Rosika
1 Like