Seg Fault when running reindex-inotify
Opened this issue · 13 comments
Hi bonidier,
I'm trying to get the watch service started, as per your instructions. However, I run into a seg fault when trying to start the reindex service. I have successfully run ./synodlna-reindex.sh start all
prior to this. As such, I am unable to wait for
Setting up watches
Watches established <===============
because the service crashes before it gets there.
Any ideas? The commands I used to run are as below.
Thanks in advance.
BESPIN> sudo /opt/etc/init.d/S99synodlna-reindex-inotify start
Password:
bad or empty PID
PID=5528
PID exists [pid:5528]
started
BESPIN> sudo /opt/etc/init.d/S99synodlna-reindex-inotify status
bad or empty PID
status: not started
BESPIN> sudo /opt/etc/init.d/S99synodlna-reindex-inotify log
set share '/music' to be watched by inotify
set share '/photo' to be watched by inotify
set share '/video' to be watched by inotify
launching inotifywait...:
PID INOTIFY=5666
DEBUG :
Hum OK, let's catch your activity...
!! you should wait the inotifywait's line 'Watches established'
/volume1/admin/scripts/synodlna-index/lib/synodlna/synodlna-synoindex-inotify.lib.sh: line 2: /tmp/synodlna-reindex-inotify.fifo: Interrupted system call
/volume1/admin/scripts/synodlna-index/synodlna-reindex-inotify.sh: line 56: 5666 Segmentation fault (core dumped) $IT_BIN/inotifywait -rm ${IT_ONLY_EVENTS} ${IT_WATCHDIR} --exclude=${IT_EXCLUDE} --format "%w|%e|%f" -o ${IT_FIFO}
Hi Azyner,
Thank you for testing and your feedback
It seems your user can't start the service, because no PID returned
I think it's a permission problem
...
BESPIN> sudo /opt/etc/init.d/S99synodlna-reindex-inotify status
bad or empty PID
status: not started
...
Can you ensure your current user is into sudoers like described into README file ( https://github.com/bonidier/synodlna-index#sudo-management )
Hi Bonidier,
A PID is returned, as evident in
BESPIN> sudo /opt/etc/init.d/S99synodlna-reindex-inotify start
Password:
bad or empty PID
PID=5528
PID exists [pid:5528]
started
It just seg faults (and therefore has stopped) by the time I run the command status
with an account that has sudo privilege. The same is true if I run the commands under root. So I'm not sure its a permissions thing.
I'm running this under DSM 5.1. I'm not sure if that makes a difference.
Hi Azyner,
In fact the "PID exists + started" is a false positive, because my init script does not sleep some seconds before testing PID, I'll fix it
the true result your second "status" test
so the script stops because of inotifywait segfault
does your inotifywait work outside of my script ?
$ /usr/local/inotify-tools/bin/inotifywait
No files specified to watch
$ /usr/local/inotify-tools/bin/inotifywait -h | head -n1
inotifywait 3.14
here is a good output for the log
...
set share '/video' to be watched by inotify
launching inotifywait...:
PID INOTIFY=4458
DEBUG :
Hum OK, let's catch your activity...
!! you should wait the inotifywait's line 'Watches established'
Setting up watches. Beware: since -r was given, this may take a while!
Watches established.
DSM 5.1 isn't supported on my NAS,
but we'll find a solution
Yep, inotify returns the output as expected
> /usr/local/inotify-tools/bin/inotifywait
No files specified to watch!
> /usr/local/inotify-tools/bin/inotifywait -h | head -n1
inotifywait 3.14
Are there other dependencies I should test for?
Hi Azyner,
There is a known issue about inotify-tools compilation on some Synology NAS,
You should exchange your hardware informations and tests results with @rvoicilas, see inotify-tools/inotify-tools#34
Try inotify-tools's tests :
cd support/inotify-tools/inotify-tools-3.14
make check
Here is a part of my output
(1 test failed, but no segfault when launching inotifywait on my NAS)
...
If you want to do a malloc trace, set MALLOC_TRACE to a path for logging.
event_to_str: test begin
event_to_str: test end
event_to_str_sep: test begin
event_to_str_sep: test end
str_to_event: test begin
str_to_event: test end
str_to_event_sep: test begin
str_to_event_sep: test end
basic_watch_info: test begin
basic_watch_info: test end
watch_limit: test begin
watch_limit: Warning, this test may take a while
test.c:258 Test 'watch_limit' failed: Verification failed (-1 != fd)
tst_inotifytools_snprintf: test begin
tst_inotifytools_snprintf: test end
Out of 73502 tests, 73501 succeeded and 1 failed.
FAIL: test
========================================
1 of 1 test failed
...
Hi Azyner, I've just pushed some fix,
get latest master commit and :
refresh service
make service
remove inotify-tools
rm -rf /usr/local/inotify-tools
make inotify-tools
=> Now inotify-tools should refuse installation if tests failed, except "watch_limit" test,
all "make check" output is logged
I have the same problem as Azyner:
./synodlna-reindex-inotify.sh
/usr/local/inotify-tools/bin/inotifywait
set share '/music' to be watched by inotify
set share '/photo' to be watched by inotify
set share '/video' to be watched by inotify
launching inotifywait...:
PID INOTIFY=31353
DEBUG :
Hum OK, let's catch your activity...
!! you should wait the inotifywait's line 'Watches established'
./lib/synodlna/synodlna-synoindex-inotify.lib.sh: line 2: /tmp/synodlna-reindex-inotify.fifo: Interrupted system call
./synodlna-reindex-inotify.sh: line 59: 31353 Segmentation fault (core dumped) $IT_BIN/inotifywait -rm ${IT_ONLY_EVENTS} ${IT_WATCHDIR} --exclude=${IT_EXCLUDE} --format "%w|%e|%f" -o ${IT_FIFO}
Hi Muena,
thank you to use it !
Did you try get latest master commit ?
the inotify-tools installation with my Makefile should have failed on tests (as I mentionned 8 days ago)?
I think inotify-tools doesn't compile properly on all CPU, may be a bug (see Inotify-tools ticket in my previous post, you should also exchange with Rvoicilas)
Muena, @azyner , If you find an inotify-tools compilation option which works for your hardware, let me aware about it !
Thanks
Bonidier,
Will do. I have the same problem as the issue you linked. (seg fault on a test) I'm looking for a fix now.
Hi Azyner and Muena
i've corrected inotify-tools installer (the install process was executed even if make fail ) and added MALLOC_TRACE file as mentionned in inotify-tools ticket
so remove /usr/local/inotify-tools and re-execute "make inotify-tools"
so for now, inotify-tools should not execute the install on your NAS
So, after updating to 6228fdffbc
(28th Nov) I removed /usr/local/inotify-tools as you instructed, and re-installed through make inotify-tools
which returned 0 (success).
Then by doing a full reindex by ./synodlna-reindex.sh start all
and finally sudo /opt/etc/init.d/S99synodlna-reindex-inotify start
the following log was output.
/usr/local/inotify-tools/bin/inotifywait
set share '/music' to be watched by inotify
set share '/photo' to be watched by inotify
set share '/video' to be watched by inotify
launching inotifywait...:
PID INOTIFY=6115
DEBUG :
Hum OK, let's catch your activity...
!! you should wait the inotifywait's line 'Watches established'
/volume1/admin/scripts/synodlna-index/lib/synodlna/synodlna-synoindex-inotify.lib.sh: line 2: /tmp/synodlna-reindex-inotify.fifo: Interrupted system call
/volume1/admin/scripts/synodlna-index/synodlna-reindex-inotify.sh: line 59: 6115 Segmentation fault (core dumped) $IT_BIN/inotifywait -rm ${IT_ONLY_EVENTS} ${IT_WATCHDIR} --exclude=${IT_EXCLUDE} --format "%w|%e|%f" -o ${IT_FIFO}
Its my understanding that make inotify
should have failed in some way. Is this correct?
Running make check
in inotify-tool-3.14 still results in 1 failed test. The log is identical to the one listed in inotify-tools/inotify-tools#34.
Thanks for your help
Hi Azyner,
I must apply another fix to install script, yet another miss which cause installation on failure..
I'll fix it this evening
Thanks
Hi Azyner and Muena,
I've just updated inotify-tools installer script, fixed some logic and added a report at the end
So remove (yet another time) /usr/local/inotify-tools and try