You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/07/05 06:07:26 UTC

[Bug 61250] New: Disabling shutdown port exit tomcat with System.exit(1) causes issue

https://bz.apache.org/bugzilla/show_bug.cgi?id=61250

            Bug ID: 61250
           Summary: Disabling shutdown port exit tomcat with
                    System.exit(1) causes issue
           Product: Tomcat 8
           Version: 8.5.8
          Hardware: PC
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: veeru.mallavarapu@yahoo.com
  Target Milestone: ----

Created attachment 35096
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35096&action=edit
Error While stopping service from windows service due to the system.exit(1)

Hi All,

I am running tomcat as windows service and disabled the shutdown port in
server.xml. 

So when I am stopping the service, tomcat service is killed and the process
also killed . However since tomcat is exited with System.exit(1) in
catalina.java --> stopServer(String[] arguments) when shutdown port is
disabled. I am seeing an alert message in windows services window stating "
Service could not able to stop and Error 1 : function error ". I have attached
the screen shot  here.

To fix this error , I have replaced system.exit(1) with system.exit(0) and now
I am not seeing that alert.

Can you please tell me , is there any  specific reason we are invoke
system.exit(1) rather system.exit(1). As we are forcibly killing JVM , I think
we can call system.exit(0) so that it will be successful operation for the
windows service. Otherwise it is treating it as exception and leading to issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61250] Disabling shutdown port exit tomcat with System.exit(1) causes issue

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61250

--- Comment #6 from Mark Thomas <ma...@apache.org> ---
I've never used WinRun4J. I'd suggest the simplest solution is to configure a
shutdown port with a strong shutdown password and ensure that server.xml is
appropriately protected.

If you need further help/advice, please use the users mailing list.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61250] Disabling shutdown port exit tomcat with System.exit(1) causes issue

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61250

--- Comment #3 from Veeru <ve...@yahoo.com> ---
Thanks you very much. Waiting for your input. At present I build the
catalina.jar with system.exit(0) as 0 represent success.

0 -- success
1 -- exception
-1 -- Error

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61250] Disabling shutdown port exit tomcat with System.exit(1) causes issue

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61250

--- Comment #1 from Veeru <ve...@yahoo.com> ---
Hi All,

I am running tomcat as windows service and disabled the shutdown port in
server.xml. 

So when I am stopping the service, tomcat service is killed and the process
also killed . However since tomcat is exited with System.exit(1) in
catalina.java --> stopServer(String[] arguments) when shutdown port is
disabled. I am seeing an alert message in windows services window stating "
Service could not able to stop and Error 1 : function error ". I have attached
the screen shot  here.

To fix this error , I have replaced system.exit(1) with system.exit(0) and now
I am not seeing that alert.

Can you please tell me , is there any  specific reason we are invoking
system.exit(1) rather system.exit(0). As we are forcibly killing JVM , I think
we can call system.exit(0) so that it will be successful operation for the
windows service. Otherwise it is treating it as exception and leading to issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61250] Disabling shutdown port exit tomcat with System.exit(1) causes issue

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61250

--- Comment #5 from Veeru <ve...@yahoo.com> ---


Thanks for quick response.

I am using WinRun4J.jar to start my tomcat as a windows service.  I am not sure
where to set this jvm mode.

And I am disabling shutdown port by setting port="-1" in server.xml.

Since the port < 0, catalina.java --> stopServer() invoking system.exit(1)

So you are suggesting don't disable tomcat port and run tomcat in jvm mode ?
Any pointers how to set this configuration is really helpful.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61250] Disabling shutdown port exit tomcat with System.exit(1) causes issue

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61250

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
If you use the default startMode of jvm, you won't see this problem.

The problem is that with startModes java and exe, Tomcat runs in a separate
process. Therefore daemon needs the shutdown port in order to be able to shut
Tomcat down. catalina.bat has essentially the same restriction.

When you run in jvm mode, Tomcat runs in the same process and when deamon calls
stop() Tomcat can detect it is running in process and shutdown.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61250] Disabling shutdown port exit tomcat with System.exit(1) causes issue

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61250

--- Comment #7 from Veeru <ve...@yahoo.com> ---
Yes I have tried it.  But that time I was seeing another issue that Error 1503.

I would suggest , It would be better to invoke system.exit(0) as we are doing
intentionally in case of port is disabled.

Thanks again for your prompt response.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 61250] Disabling shutdown port exit tomcat with System.exit(1) causes issue

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61250

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
The exit code of -1 is correct in that case. The user is trying to use the
shutdown command when the port is disabled.

We need to look at how we integrate with Commons Daemon and how Daemon handles
this to see if there is a way to avoid the error message.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org