On 05/11/2019 15:25, Chris Hegarty wrote:
So the server is getting a connection from “something else” on on the network, and your changes protect against that, right? Is there any value, from a diagnostic point of view, to emitting whatever “unexpected” data is received?
Ah - no. Actually the server is getting a "Connection Reset", which shows up intermittently and caused the update of the counter to be skipped. The log had this too - unfortunately on System.out (I moved it to System.err like the other traces since then). java.net.SocketException: Connection reset at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:323) at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350) at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803) at java.base/java.net.Socket$SocketInputStream.read(Socket.java:937) at java.base/java.io.InputStream.readNBytes(InputStream.java:503) at ShortRequestBody$Server.run(ShortRequestBody.java:261) Why exactly we get that connection reset I'm not sure (this is Windows) - but possibly the client detects that too many/too few bytes are sent and closes the connection before the server has managed to read off all the bytes. best regards, -- daniel