Hi, all!

There is an issue observed on Windows with recent versions of Tomcat
when stopping them as a service:
https://issues.apache.org/jira/browse/DAEMON-195

See the issue for details.

It is not observed when using "Stop" button in from Tomcat
configuration dialog, or using menu on the tray icon, but it is
observed when using system tools, such as "net stop Tomcat7" call, or
services lists in the Control Panel.


I think that it is related to the change that Tomcat now calls
System.exit(0) in Catalina#stopServer(String[]) when being run as a
service. That was r1002349 and r1004426.

I think that reverting the change will be bad, because as far as I
remember, it will result in service exiting as soon as stop() method
returns, without waiting for the shutdown to complete.

I found that this issue can be solved by changing configuration of the service:
- call java.lang.System#exit() instead of
org.apache.catalina.startup.Bootstrap#main("stop") to stop Tomcat.

In prunsrv of commons-daemon there is special support for calling
java.lang.System#exit() and it does solve this issue.

Thus I propose to change Tomcat installer and service.bat to use this
method of stopping Tomcat.



I wonder
1) whether this is an issue on unixes as well. Maybe jsvc installation
docs should be updated accordingly.
2) whether prunsrv can be changed so that running
java/lang/System#exit() were not implemented as a special case.

Other option could be to leave it as is, at least for several months,
and leave it to up to the users to reconfigure the service. -- until
we know more about the issue. Maybe this can be solved inside procrun
somehow.


Calling System.exit() explicitly will be a bit faster and more
explicit, but we won't be able to print a message about that in our
catalina.log. Though commons-daemon prints a message to its own log so
the users will be able to look there.

I tested running with a SecurityManager and there are no problems: it
does not prevent java/lang/System#exit() being called from
commons-daemon.


Any comments?

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to