Hello,
I encountered strange problem. I have a multiplayer game server, which communicates with clients through standard sockets (I’m not using NIO for several reasons). The scenario is pretty simple: I have 2 threads, first one waits for new connections, the second handles everything else.
The server works very well - runs for days, weeks, handles thousands connections without a problem. BUT then suddenly, out of the blue: the server froze up. No exception, nothing. Interesting is, that it was still possible to make a connection, but it was not possible to communicate. It means, that “connector” thread was still running, but “worker” thread froze up. Well, naturally, I killed the server, restarted it with remote debugging enabled and waited.
After several days, same thing happened again. I started remote debugging session to find out where is the problem, and:
- “connector” thread was working, as expected
- “worker” thread was frozen at OutputStream::write(byte[], int, int) >:(
How could this happen? As far as I know, writing to socket is non-blocking, it doesn’t even throw an expection.
After several weeks of experiments I found out, that it doesn’t stay frozen forever, it continues after some time (not sure how long, but it must be approx 10 minutes)
All I can guess is, that there is either some bug in java, or in operating system. I’m running 1.4.2_06-b03 on Fedora Core 3.
Anybody experienced something similar? Any suggestions?
The user just closes the brower and connection breaks. (Client is applet) The server seems to be able to detect it. It runs for several days and handles hundreds, sometimes thousands connections without hiccup before it happens. But once I also saw it happen 10 minutes after starting the server, so it is not determined by some amout of previouos connections. And in general it’s quite rare, it happens once per several days.