2

I need to increase Tomcat shutdown timeout to 45 seconds in Windows. When I stop Tomcat in the services. It takes almost 35-40 seconds. How could I increase shutdown timeout in Tomcat configuration?

GccGUY
  • 341
  • 1
  • 3
  • 12
  • Does this help? https://docs.bmc.com/docs/ars1808/increasing-the-shutdown-timeout-in-the-tomcat-configuration-tool-820495877.html or this? https://stackoverflow.com/questions/52878053/tomcat-graceful-shutdown – Thomas Jun 23 '21 at 11:53
  • I didn't understand first link. Where is this Start > All Programs > Apache Tomcat > Configure Tomcat path ? The other link is not clear to put the time where. Could you help me little to clarify? – GccGUY Jun 23 '21 at 12:39
  • How are you initiating the shutdown? – Stephen C Jun 23 '21 at 12:52
  • Well, the second link states that you'd pass the shutdown timeout to `catalina.sh` (on Windows it's probably `catalina.bat`) so you might look into those scripts which normally can be found in Tomcat's bin directory. – Thomas Jun 23 '21 at 13:18

2 Answers2

2

According for the Tomcat documentation for the Windows services integration, there is a --StopTimeout option that you can provide when configuring the service that gives a timeout for graceful service shutdowns.

If you have already installed the service, you can edit the StopTimeout value via the "Shutdown" tab of the Tomcat Monitor.

Note that this parameter is a standard procrun setting.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • This value can also be edited in the _"Shutdown"_ tab of Tomcat Monitor (procrun). – Piotr P. Karwasz Jun 23 '21 at 13:40
  • Should I add at service.bat like "--StopTimeout="45" ? – GccGUY Jun 23 '21 at 18:34
  • `service.bat` is only used when you install a new service. Run `tomcat9.exe //US --StopTimeout=45` or change the value in the graphical interface _"Tomcat Monitor"_ (the `tomcat9w.exe` executable). – Piotr P. Karwasz Jun 23 '21 at 19:51
  • I added StopTimeout=45 in service.bat as a parameter. Then I installed. I saw 45 seconds timeout in the shutdown tab. But how could I test it? – GccGUY Jun 24 '21 at 06:54
  • Try shutting down Tomcat and see if it shuts down cleanly (rather than being killed). For extra points, set the value to (say) 10 seconds and observe what happens when Tomcat shutdown takes too long. Check the logs. – Stephen C Jun 24 '21 at 07:03
  • @StephenC I did 1 second and it takes more than 1 second. And I couldn't any log where it is ? There is no log Tomcat/logs directory. Just Installation logs exists. – GccGUY Jun 24 '21 at 07:21
  • Increase Tomcat Monitor logging to `DEBUG` and check `commons-daemon..log`. – Piotr P. Karwasz Jun 24 '21 at 07:49
  • @GccGUY - What you are looking for is indications in the logs that Tomcat has been >>killed<< during shutdown. – Stephen C Jun 24 '21 at 08:02
  • Yeah I am looking like that. But I couldn't get any log. When I changed the DEBUG or checked in the logs/ folder. – GccGUY Jun 24 '21 at 10:03
-2

I'm not sure, but maybe anything helpful in workers.properties file in ../httpd/conf/

Gaena
  • 17
  • 6