tomcat - 谷歌计算引擎套接字问题

标签 tomcat debian google-compute-engine google-cloud-platform google-cloud-debugger

最近几天,Debian(Google Compute Engine)服务器每天都面临套接字不可用的问题,需要重新启动 tomcat。

Dec 30, 2015 1:16:53 PM org.apache.tomcat.util.net.JIoEndpoint$Acceptor run
SEVERE: Socket accept failed
java.net.SocketException: Too many open files
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
    at java.net.ServerSocket.implAccept(ServerSocket.java:530)
    at java.net.ServerSocket.accept(ServerSocket.java:498)
    at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60)
    at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:220)
    at java.lang.Thread.run(Thread.java:745)

在使用 netstat -ap 检查时发现 GOOGLE :( 正在淹没服务器。

tcp        1      0 backend-tomcat:53976 wk-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:42251 wl-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:45929 wn-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:42159 wl-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:55348 wo-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:44973 wa-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:42148 wl-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:45729 wn-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:45721 wn-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:42146 wl-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:36557 wq-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:45723 wn-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:45915 wn-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:45295 wn-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:53819 wk-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        0      0 backend-tomcat:45968 wn-in-f95.1e100.n:https ESTABLISHED 5081/java       
tcp        1      0 backend-tomcat:41737 wl-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:55132 wm-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:53969 wk-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:40883 wj-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:45734 wn-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:40889 wj-in-f95.1e100.n:https CLOSE_WAIT  5081/java       
tcp        1      0 backend-tomcat:41834 wl-in-f95.1e100.n:https CLOSE_WAIT  5081/java       

使用lsof -p 5081检查了该过程,并且有大量以下行列表

java    5081 tomcat7 1181u  IPv4            1959257      0t0     TCP backend-tomcat.c.stutzenappointments.internal:48570->wb-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1182u  IPv4            1959420      0t0     TCP backend-tomcat.c.stutzenappointments.internal:48575->wb-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1183u  IPv4            1959526      0t0     TCP backend-tomcat.c.stutzenappointments.internal:48577->wb-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1184u  IPv4            1959676      0t0     TCP backend-tomcat.c.stutzenappointments.internal:48583->wb-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1185u  IPv4            1960099      0t0     TCP backend-tomcat.c.stutzenappointments.internal:48591->wb-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1186u  IPv4            1959857      0t0     TCP backend-tomcat.c.stutzenappointments.internal:48589->wb-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1187u  IPv4            1960209      0t0     TCP backend-tomcat.c.stutzenappointments.internal:48596->wb-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1188u  IPv4            1960352      0t0     TCP backend-tomcat.c.stutzenappointments.internal:49524->wa-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1189u  IPv4            1960555      0t0     TCP backend-tomcat.c.stutzenappointments.internal:49526->wa-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1190u  IPv4            1960721      0t0     TCP backend-tomcat.c.stutzenappointments.internal:49531->wa-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1191u  IPv4            1960962      0t0     TCP backend-tomcat.c.stutzenappointments.internal:49537->wa-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1192u  IPv4            1961151      0t0     TCP backend-tomcat.c.stutzenappointments.internal:49539->wa-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1193u  IPv4            1961318      0t0     TCP backend-tomcat.c.stutzenappointments.internal:49544->wa-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1194u  IPv4            1961557      0t0     TCP backend-tomcat.c.stutzenappointments.internal:49550->wa-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1195u  IPv4            1961828      0t0     TCP backend-tomcat.c.stutzenappointments.internal:46380->wl-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1196u  IPv4            1962155      0t0     TCP backend-tomcat.c.stutzenappointments.internal:46386->wl-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1197u  IPv4            1962356      0t0     TCP backend-tomcat.c.stutzenappointments.internal:46392->wl-in-f95.1e100.net:https (CLOSE_WAIT)
java    5081 tomcat7 1198u  IPv4            1962461      0t0     TCP backend-tomcat.c.stutzenappointments.internal:46393->wl-in-f95.1e100.net:https (CLOSE_WAIT)

从ulimit发现打开文件限制设置为最大值

open files                      (-n) 65536

是因为GCE的Cloud Debugger功能吗?有什么办法可以要求 Google 不要让服务器每天都流血吗?

最佳答案

感谢您的举报。此错误现已修复:https://github.com/GoogleCloudPlatform/cloud-debug-java/commit/057d2f181ebfb5b670e31ecc9c155b38cc495150 .

请在 format_env_gce.sh 脚本中更改应用程序版本,以确保虚拟机选择最新版本的调试器代理。例如:

...format_env_gce.sh --version=2 ...

如果您使用Managed VM ,下次重新部署时它会自动更新到最新版本的调试器代理。

最新的二进制文件可在项目的 GitHub page 上获取。 .

关于tomcat - 谷歌计算引擎套接字问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34532951/

相关文章:

Python:Selenium 无法在 UDOO 上找到空闲端口

linux - 我如何将 postinst 脚本与 fakeroot deb 包生成器一起使用

spring - 如何在使用 Nginx 作为反向代理的 Spring Boot 应用程序上记录嵌入式 Tomcat 访问日志上的真实客户端 IP?

java - 在Tomcat中执行shell命令

spring - 如何读取tomcat错误日志

python - easy_install 或 pip install 找不到包

html - 从 servlet 使用调度程序时如何刷新 jsp 页面?

google-compute-engine - 从 GCE 导出图像

linux - Ssh端口转发谷歌计算引擎

google-app-engine - 如何在使用 Google App Engine 时设置静态 IP 地址