windows java.net.SocketException:没有可用的缓冲区空间(已达到最大连接数?):JVM_Bind

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10088363/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:25:51  来源:igfitidea点击:

java.net.SocketException: No buffer space available (maximum connections reached?): JVM_Bind

windowstomcatjvmsocketexceptionconnection-leaks

提问by Michael B?ckling

Tomcat is running a webapp under Windows. After a few days (under very low load), the exception mentioned in the title starts to appear in the logs, no new connections can be established from that point on, the only fix is then to reboot the server.

Tomcat 在 Windows 下运行一个 webapp。几天后(在非常低的负载下),标题中提到的异常开始出现在日志中,从那时起无法建立新的连接,唯一的解决方法是重新启动服务器。

Environment:

环境:

  • Latest Tomcat 6
  • Windows Server 2008 R2
  • JDK 6 update 30
  • SQL Server 2008
  • Kerberos authentication
  • 最新的 Tomcat 6
  • 视窗服务器 2008 R2
  • JDK 6 更新 30
  • SQL Server 2008
  • Kerberos 身份验证

Evidence collected so far:

目前收集到的证据:

  • netstat shows no excessive amount of connections
  • ProcessExplorer shows no excessive amount of open file handles
  • system main memory usage is average
  • JVM heap usage is average
  • restarting Tomcat does not solve the problem
  • netstat 显示没有过多的连接
  • ProcessExplorer 显示没有过多的打开文件句柄
  • 系统主内存使用量平均
  • JVM 堆使用量是平均的
  • 重启Tomcat并不能解决问题

Open questions:

开放问题:

  • if we were leaking connections, shouldn't they show up in netstat?
  • shouldn't a restart of the appserver resolve the problem, because the OS should free all process resources?
  • is there a way to trace the problem to its origin? E.g. installing monitoring software, maybe something similar to lsof etc.?
  • 如果我们泄漏了连接,它们不应该出现在 netstat 中吗?
  • 重新启动应用程序服务器是否应该解决问题,因为操作系统应该释放所有进程资源?
  • 有没有办法追踪问题的根源?例如安装监控软件,也许类似于 lsof 等?

I'm out of ideas, any hints appreciated!

我没有想法,任何提示表示赞赏!

回答by Michael B?ckling

The reason we got this error is a bug in Windows Server 2008 R2 / Windows 7. The kernel leaks loopback sockets due to a race condition on machines with more than one core, this patch fixes the issue: http://support.microsoft.com/kb/2577795

我们收到此错误的原因是 Windows Server 2008 R2 / Windows 7 中的一个错误。由于具有多个内核的机器上的竞争条件,内核泄漏环回套接字,此补丁修复了该问题:http: //support.microsoft。 com/kb/2577795

回答by mvanle

I was running Alfresco Community 4.0d on Windows 7 64 bit and had the same symptoms and errors.

我在 Windows 7 64 位上运行 Alfresco Community 4.0d 并且有相同的症状和错误。

The problem was fixed with Microsoft's patch: "Kernel sockets leak on a multiprocessor computer that is running Windows Server 2008 R2 or Windows 7" (http://support.microsoft.com/kb/2577795) (ie. Buddy Casino's answer (see below)).

该问题已通过 Microsoft 的补丁修复:“运行 Windows Server 2008 R2 或 Windows 7 的多处理器计算机上的内核套接字泄漏”(http://support.microsoft.com/kb/2577795)(即 Buddy Casino 的回答(参见以下))。

Another observation I'd like to add is that Windows connections (Internet Explorer, Remote Desktop etc) would work again about 5-10 mins after the Alfresco services were shutdown.

我想补充的另一个观察结果是,Windows 连接(Internet Explorer、远程桌面等)将在 Alfresco 服务关闭后大约 5-10 分钟再次工作。

Alfresco is an excellent product and I was afraid I would have to scrap it. Fortunately stackoverflow came to the rescue !

Alfresco 是一款出色的产品,我担心我不得不报废它。幸运的是,stackoverflow 来了!

Thanks again to Buddy Casino's answer.

再次感谢好友赌场的回答。

Boo to the person who down-voted the Question.

对这个问题投反对票的人嘘。

回答by J Jost

We are seeing the same thing on a similar setup, W2008R2, Tomcat 6.0.29, Java 1.6.0.25. Restarting tomcat does not help, but restarting the server itself does, at least for a while. After the last time we started shutting down individual services and believe we have it narrowed down to either an instance of Alfresco that is also running on the server or the Backup Exec Agent services. After those services (four in total) were stopped, the applications in Tomcat started working again, although we were still seeing the buffer/connections error in the stdout log which was strange. Will need to wait for the problem to return before confirming which are the culprit, which could be anywhere from a few days to a week or more.

我们在类似的设置 W2008R2、Tomcat 6.0.29、Java 1.6.0.25 上看到了同样的事情。重新启动 tomcat 没有帮助,但重新启动服务器本身有帮助,至少有一段时间。在上次我们开始关闭个别服务之后,我们相信我们已将范围缩小到同样在服务器上运行的 Alfresco 实例或 Backup Exec 代理服务。在这些服务(总共四个)停止后,Tomcat 中的应用程序再次开始工作,尽管我们仍然在 stdout 日志中看到缓冲区/连接错误,这很奇怪。在确认哪些是罪魁祸首之前,需要等待问题再次出现,这可能是几天到一周或更长时间。

Any chance you are running either Alfresco or BE on your server?

您是否有机会在服务器上运行 Alfresco 或 BE?