当TongWeb端口不能访问时,常通过netstat命令检查端口状态是否正常,如下图所示:
引起这个问题的原因主要有:
1. 访问量过大,通过jstack检查线程占满,同时队列也占满,日志中报:Maximum connections queued reached (10000)。
2. 之前文章所说NIO2 线程池的JDK bug导致的。
还有一种情况是因为内存溢出,导致的线程退出。如果在日志中看到如下异常信息,说明该线程可能因为内存溢出而退出,通过jstack检查相应的线程已经不存在。
情况一:特别是NIO线程池的 Acceptor线程不存在后,不在处理请求。
情况二:ContainerBackgroundProcessor[StandardEngine[TONGWEB]] 线程终止后,则后台清理session的任务终止, 导致session只增不减。
情况三:Auto-deploy-timer线程终止后,则自动部署功能失效。
2026-05-09 06:41:01 [ERROR] - Exception in thread "I/O dispatcher 32" 2026-05-09 06:41:01 [ERROR] - java.lang.OutOfMemoryError: Java heap space 2026-05-09 06:41:01 [ERROR] - Exception in thread "TW-9060-Acceptor" 2026-05-09 06:41:01 [ERROR] - java.lang.OutOfMemoryError: Java heap space [2026-05-11 14:38:07 909] [SEVERE] [http-nio-8088-exec-11] [web-container] [Failed to complete processing of a request] java.lang.OutOfMemoryError: GC overhead limit exceeded [2026-05-11 14:38:06 736] [WARNING] [http-nio-8088-Acceptor-0] [systemout] [Exception in thread "http-nio-8088-Acceptor-0" ] [2026-05-11 14:41:22 006] [WARNING] [Auto-deploy-timer] [systemout] [Exception in thread "Auto-deploy-timer" ] [2026-05-11 14:41:22 813] [WARNING] [RMI RenewClean-[192.168.96.1:7200]] [systemout] [Exception in thread "RMI RenewClean-[192.168.96.1:7200]" ] [2026-05-11 14:41:22 940] [WARNING] [RMI RenewClean-[192.168.96.1:7200]] [systemout] [java.lang.OutOfMemoryError: GC overhead limit exceeded] [2026-05-11 14:41:22 940] [WARNING] [Auto-deploy-timer] [systemout] [java.lang.OutOfMemoryError: GC overhead limit exceeded] [2026-05-11 14:41:23 789] [WARNING] [http-nio-8088-AsyncTimeout] [systemout] [Exception in thread "http-nio-8088-AsyncTimeout" ] [2026-05-12 13:29:02 368] [WARNING] [http-nio2-0.0.0.0-8088-exec-5] [systemout] [java.lang.OutOfMemoryError: GC overhead limit exceeded] [2026-05-12 13:29:08 462] [SEVERE] [ContainerBackgroundProcessor[StandardEngine[TONGWEB]]] [core] [Unexpected death of background thread ContainerBackgroundProcessor[StandardEngine[TONGWEB]]] [2026-05-12 13:28:59 914] [WARNING] [Auto-deploy-timer] [systemout] [Exception in thread "Auto-deploy-timer" ]根据JDK的解释:OutOfMemoryError一定会杀死当前线程, 只要代码执行时抛出OOM 错误,线程会立刻停止运行, 不会被 try-catch (Exception) 捕获。