views:

71

answers:

0

I've a strange problem with a java server application running on a windows machine; sometimes the SocketChannel I just obtained by ServerSocketChannel.accept immediately returns an error when I try to read data from it - the strange thing is that at the same time the client that started the incoming connection is stuck waiting for the answer it expects to receive from the server, that is the pattern is something like this:

  1. client from another machine calls connect, connect returns, client writes logon request, client starts waiting for logon response
  2. server wakes up on accept, tries to read and fails immediately, so it closes the socket
  3. client keeps on waiting, as if the connection was established and no data was flowing in

this pattern keeps repeating for a while (the client eventually times out in a few seconds and retries again) until eventually logon succeeds some minutes later.

Has anyone an explanation for this? This looks like some kind of resource exhaustion problem on the server side, but I really have no clear idea of what is going on because I can't reproduce the problem and all I had to understand what is going on is logfiles.

TIA