3

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.

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.

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.

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.

Machines got Windows updates. I did tests with the same Windows version fully updated but I can't reproduce.

I'm out of solution now.

Any ideas Thanks

sbrisson
  • 346
  • 1
  • 9

2 Answers2

2

A windows update affected the release of address/port after process shutdown.

Refer to Address Bind exception in Tomcat for solution.

sbrisson
  • 346
  • 1
  • 9
1

I am on the same problem here. I've got several Java instances running as servers but as soon as any of those Java applications is killed and restarted then they fail to do so complaining that the port is still in use. Never happened before and I used to restart them every now and then.

My Windows server machine also received some new updates a few days ago.

By the way, I am using a tool to monitor ports and applications and those ports are not being used by any program, so the application is actually killed.

JoSeMa
  • 141
  • 1
  • 3