Introduction of koha-functions bash lib (Bug 11404) have missed the need of specifying pidfiles directory on restarting/stopping zebra server. This might also affect Bug 12009 - Sometimes a koha-common restart won't restart zebra, and might break zebra index on update. Specs: The function is_zebra_running() (and possibly also is_indexer_running() ) will always return 1 (false) even if zebra is running. Thus a koha-restart-zebra/koha-stop-zebra will do nothing. Patch to come.
Created attachment 39984 [details] [review] Bug 14361 - koha-restart-zebra fails and probably breaks upgrade This patch fixes the koha-restart-zebra and koha-stop-zebra scripts by adding pidfiles folder to the test is_zebra_running. It also adds pidfiles to the test is_indexer_running so that koha-rebuild-zebra will work properly. Test plan: 1) check if zebrasrv is running, get pid of zebrasrv ps ax | grep zebrasrv 2) In my case, there was also a warning on the about.pl page on a fresh install: Error message from Zebra: 1011 (bad credentials) 3) try to restart zebra koha-restart-zebra instancename You will get a msg : Zebra does not appear to have been running for instancename Starting Zebra server for instancename 4) check again if zebrasrv is running ps ax | grep zebrasrv and see that pid has not changed, thus it is not restarted 5) Apply patch 6) repeat 4) and watch now how pid has changed If there was a warning on about.pl it should now be gone
Note that if using gitify or some other way to make a koha dev instance from a standard one, make sure that the referenced file : /usr/share/koha/bin/koha-functions.sh is updated also.
*** Bug 12009 has been marked as a duplicate of this bug. ***
Created attachment 40234 [details] [review] Bug 14361 - koha-restart-zebra fails and probably breaks upgrade This patch fixes the koha-restart-zebra and koha-stop-zebra scripts by adding pidfiles folder to the test is_zebra_running. It also adds pidfiles to the test is_indexer_running so that koha-rebuild-zebra will work properly. Test plan: 1) check if zebrasrv is running, get pid of zebrasrv ps ax | grep zebrasrv 2) In my case, there was also a warning on the about.pl page on a fresh install: Error message from Zebra: 1011 (bad credentials) 3) try to restart zebra koha-restart-zebra instancename You will get a msg : Zebra does not appear to have been running for instancename Starting Zebra server for instancename 4) check again if zebrasrv is running ps ax | grep zebrasrv and see that pid has not changed, thus it is not restarted 5) Apply patch 6) repeat 4) and watch now how pid has changed If there was a warning on about.pl it should now be gone Signed-off-by: Mason James <mtj@kohaaloha.com>
works perfectly!, tested on master branch
Created attachment 40235 [details] [review] Bug 14361: koha-restart-zebra fails and probably breaks upgrade This patch fixes the koha-restart-zebra and koha-stop-zebra scripts by adding pidfiles folder to the test is_zebra_running. It also adds pidfiles to the test is_indexer_running so that koha-rebuild-zebra will work properly. Test plan: 1) check if zebrasrv is running, get pid of zebrasrv ps ax | grep zebrasrv 2) In my case, there was also a warning on the about.pl page on a fresh install: Error message from Zebra: 1011 (bad credentials) 3) try to restart zebra koha-restart-zebra instancename You will get a msg : Zebra does not appear to have been running for instancename Starting Zebra server for instancename 4) check again if zebrasrv is running ps ax | grep zebrasrv and see that pid has not changed, thus it is not restarted 5) Apply patch 6) repeat 4) and watch now how pid has changed If there was a warning on about.pl it should now be gone Signed-off-by: Mason James <mtj@kohaaloha.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Good catch Benjamin! It works as expected with the patch.
This patch needs to be pulled to 3.16, 3.18 and 3.20 branches
Should I see the pid file with ps ax | grep zebrasrv ? Because I don't, with or without the patch.
*** Bug 14466 has been marked as a duplicate of this bug. ***
Does the indexer daemon use a pid file? When I wrote the patch for the duplicate bug I thought it does not, so I did not patch it. Also "Note that the --running option must appear before any --pidfile or --pidfiles option when checking if another user's daemon is running otherwise you might get an error about the pidfile directory not being writable."
Jonathan, yes you should definitely see pidfile dir setting. ps ax | grep zebrasrv should give two hits: * the daemon process, which should give the active daemon flags, including --pidfiles=/var/run/koha/[instance]/ * the actual zebrasrv process, with the flags for the server. example: 1124 ? S 0:00 daemon --name=name-koha-zebra --pidfiles=/var/run/koha/name/ --errlog=/var/log/koha/name/zebra-error.log --stdout=/var/log/koha/name/zebra.log --output=/var/log/koha/name/zebra-output.log --verbose=1 --respawn --delay=30 --user=name-koha.name-koha -- zebrasrv -v none,fatal,warn -f /etc/koha/sites/name/koha-conf.xml 1136 ? S 0:00 zebrasrv -v none,fatal,warn -f /etc/koha/sites/name/koha-conf.xml if you don't see the --pidfiles=/var/run/koha/[instance]/, either the daemon is not running and/or the patch is not applied. koha-restart-zebra [instance] would attempt to restart daemon
Mirko, yes zebra daemon uses a pidfile, which is placed in the koha pidfiles dir: ex.: (my instance is just called 'name') root@73107be4a833:~# cat /var/run/koha/name/name-koha-zebra.pid 1124 about the --running and order you seem to be right. I have not noticed any errors, but docs say so. Please feel free to adjust the patch. It is not pushed yet
What I mean is, there is no --pidfiles used in koha-indexer, while in koha-start-zebra, it is. The latter being the reason why is_zebra_running did not work. I suppose it does not matter for is_indexer_running, but I have not tried. My patch is on Bug 14466.
I'm not sure about 3.16.x -- I have QA system running 3.16.{can't remember what} which does not have --pidfiles in the daemon ps list.
(In reply to M. Tompsett from comment #14) > I'm not sure about 3.16.x -- I have QA system running 3.16.{can't remember > what} which does not have --pidfiles in the daemon ps list. confirmed, its not needed for 3.16 :)
Patch pushed to master. Thanks Benjamin!
Pushed to 3.18.x will be in 3.18.11
Pushed to 3.20.x will be in 3.20.4