【问题标题】:Tomcat service stopping take too long upgrading from 32 bit to 64 bit on windowsTomcat 服务停止在 Windows 上从 32 位升级到 64 位需要太长时间
【发布时间】:2018-09-12 14:28:41
【问题描述】:

我在基于 32 位操作系统的 tomcat 上运行 java web 应用程序,启动和停止 tomcat 大约需要 2-4 秒。我已经将 JRE、Tomcat 升级到 64 位,并且 tomcat 服务在启动时快速或正常启动,但停止了 1 分钟,这很长,我很好奇停止的时间,或者它被 Windows 服务管理器杀死了停顿时间长。

Web 应用程序正在运行用于 Rest API 的 Spring 框架和用于 http 通信的 pubnub SDK,我认为它不应该在库的 32 位和 64 位环境之间产生差异。此外,WEB App 正在运行一些后台任务,但没有复杂的任务......

tomcat 停止这么慢可能是什么问题?尝试使用 32 位 jdk 和 64 位 jdk 编译应用程序,但结果相同。

[2018-04-04 17:49:21] [info]  ( prunsrv.c:984 ) [ 2460] Stopping service...
[2018-04-04 17:49:21] [debug] ( javajni.c:937 ) [  864] argv[0] = stop
[2018-04-04 17:49:21] [debug] ( javajni.c:990 ) [  864] Java Worker thread started org/apache/catalina/startup/Bootstrap:main
[2018-04-04 17:49:21] [debug] ( javajni.c:1013) [ 3336] Java Worker thread finished org/apache/catalina/startup/Bootstrap:main with status = 0
[2018-04-04 17:49:21] [debug] ( javajni.c:1013) [  864] Java Worker thread finished org/apache/catalina/startup/Bootstrap:main with status = 0
[2018-04-04 17:49:21] [debug] ( prunsrv.c:1577) [ 2724] Worker finished.
[2018-04-04 17:49:21] [debug] ( prunsrv.c:1586) [ 2724] Waiting for ShutdownEvent
[2018-04-04 17:49:21] [debug] ( prunsrv.c:885 ) [ 2724] reportServiceStatusE: dwCurrentState = 3, dwWin32ExitCode = 0, dwWaitHint = 60000, dwServiceSpecificExitCode = 0
[2018-04-04 17:49:22] [debug] ( prunsrv.c:1032) [ 2460] Waiting for Java JNI stop worker to finish...
[2018-04-04 17:49:22] [debug] ( prunsrv.c:1034) [ 2460] Java JNI stop worker finished.
[2018-04-04 17:49:22] [debug] ( prunsrv.c:885 ) [ 2460] reportServiceStatusE: dwCurrentState = 3, dwWin32ExitCode = 0, dwWaitHint = 300000, dwServiceSpecificExitCode = 0
[2018-04-04 17:49:22] [debug] ( prunsrv.c:1141) [ 2460] Waiting for worker to die naturally...
[2018-04-04 17:49:22] [debug] ( prunsrv.c:1152) [ 2460] Worker finished gracefully in 0 ms.
[2018-04-04 17:49:22] [info]  ( prunsrv.c:1162) [ 2460] Service stop thread completed.
[2018-04-04 17:49:22] [debug] ( prunsrv.c:1589) [ 2724] ShutdownEvent signaled
[2018-04-04 17:49:22] [debug] ( prunsrv.c:1594) [ 2724] Waiting 1 minute for all threads to exit
[2018-04-04 17:49:22] [debug] ( prunsrv.c:885 ) [ 2724] reportServiceStatusE: dwCurrentState = 3, dwWin32ExitCode = 0, dwWaitHint = 60000, dwServiceSpecificExitCode = 0
[2018-04-04 17:50:22] [debug] ( prunsrv.c:1607) [ 2724] JVM destroyed.
[2018-04-04 17:50:22] [debug] ( prunsrv.c:885 ) [ 2724] reportServiceStatusE: dwCurrentState = 1, dwWin32ExitCode = 0, dwWaitHint = 0, dwServiceSpecificExitCode = 0
[2018-04-04 17:50:22] [info]  ( prunsrv.c:1645) [ 3836] Run service finished.
[2018-04-04 17:50:22] [info]  ( prunsrv.c:1814) [ 3836] Commons Daemon procrun finished

以下是尝试停止 tomcat 服务后的日志,特别有趣的是:17:49:22 到:17:50:22

【问题讨论】:

  • 既然您添加了信息,我将删除我的第一个答案,因为它不是一个好的答案。
  • 对其他人来说,这是 pubnub sdk 做的废话......我已经降级了 pubnub java sdk,一切都恢复顺利。

标签: tomcat service java-8 64-bit tomcat8


【解决方案1】:

正如doc 中所述,Tomcat 使用procrun 作为其服务实用程序。安装服务时,您应该添加一个参数:--StopTimeout 后跟您允许服务的等待时间(例如尝试 2 或 3 秒)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-19
    • 2013-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-04
    • 2011-12-08
    • 1970-01-01
    相关资源
    最近更新 更多