Apache common daemons - procrun. Stop service hanging

3.7k Views Asked by At

Hi I installed my java service to run through apache common daemons prunsrv. I have problems stopping it. Sometimes when restarting the service from the windowse services console it hangs; the strange thing is that my service is correctly stopped as shown in the apache logs. The problem seems the same as this https://issues.apache.org/jira/browse/DAEMON-288 even if there the fix seems to have been already implemented in version 0.15. With version 0.14 the problem is not present but with 0.14 version randomly the service is restarted (not suitable for my needs). Here there are the logs showing the stop of the service:

[2016-01-19 11:12:52] [info]  [ 2036] Commons Daemon procrun (1.0.15.0 64-bit) started
[2016-01-19 11:12:53] [info]  [ 2036] Running 'xxxxxxx' Service...
[2016-01-19 11:12:53] [info]  [ 1400] Starting service...
[2016-01-19 11:12:54] [info]  [ 1400] Service started in 1546 ms.
[2016-01-19 11:58:50] [info]  [ 2648] Stopping service...
[2016-01-19 11:58:51] [info]  [ 2648] Service stop thread completed.

After that the windows service console prints "stopping service" and after some time (1 minute I think) it says "Windows could not stop the service on local computer. Error 1053: The service did not respond to the start or control request in a timely fashion"; then the service is impossibile to restart (windows service console continues to indicate it as stopping), and we have to reboot the machine.

Has anyone encountered the same problem?

Thanks

2

There are 2 best solutions below

0
On

Yes, I found that problem with the 1.0.15 version, and for me it was enough downgrading to the previous 1.0.14 version. It is related to the open bug:

https://issues.apache.org/jira/browse/DAEMON-298

(Although 288 is marked as solved).

0
On

You can use System.exit(0); in your stop method, if you can't find a good way.