地址已经在使用:JVM_Bind 但没有使用端口和 netstat 列出进程 [英] Address already in use: JVM_Bind but no process is listed using port with netstat
问题描述
我有一个 Java 进程,它使用 ServerSocket API (Java 8) 并绑定到本地端口 12000.进程在 Windows 服务包装器 (exe4j) 下运行.我有一个在凌晨 4 点运行的计划任务,它停止服务并在几秒钟后重新启动它.该流程已在 400 多个客户地点安装.
I have a java process that make use of ServerSocket API (Java 8) and bind to the local port 12000. Process runs under a Windows service Wrapper (exe4j). I have a scheduled task that runs at 4am that stop the service and restart it after a couple of seconds. That process is installed over 400 customers locations.
一切都很顺利,直到上周五.一些进程未能在凌晨 4 点正确重启.在我能够连接和验证的 2 台服务器上,重新启动失败,同时显示地址已在使用中:JVM_Bind".系统似乎仍在使用端口 12000.
Everything was running smooth until about last friday. A few processes failed to restart properly at 4am. On 2 servers I was able to connect and verify, the restart failed with both a "Address already in use: JVM_Bind". It's seems that the port 12000 was still in use by a the system.
我使用了所有我知道的工具(processexplorer、tcpview、netstat -ano、命名)试图找到进程......但没有成功.只有重新启动机器才能解决问题.但是一两个晚上后问题又来了.
I used every tools (processexplorer, tcpview, netstat -ano, name it) I know to try to find the process... with no success. Only a machine reboot fixed the issue. But problem came back a night or two later.
一些阅读后,我看到我正在做一个无限超时的 sockect.accept()
所以我把它改成了<代码>socket.setSoTimeout(15000);socket.accept();相反.
After some reading, I saw that I was doing a sockect.accept()
with infinite timeout so I changed it for
socket.setSoTimeout(15000);
socket.accept();
instead.
我已经安装了新版本,但问题仍然存在.
I putted the new version in place but the problem is still there.
机器获得了 Windows 更新.我使用完全更新的相同 Windows 版本进行了测试,但无法重现.
Machines got Windows updates. I did tests with the same Windows version fully updated but I can't reproduce.
我现在没有办法了.
任何想法谢谢
推荐答案
Windows 更新影响进程关闭后地址/端口的释放.
A windows update affected the release of address/port after process shutdown.
参考Tomcat地址绑定异常解决方法.
这篇关于地址已经在使用:JVM_Bind 但没有使用端口和 netstat 列出进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!