UnahD
UnahD

Reputation: 877

TimeoutException while sending data via WebSocket

I'm encountering java.util.concurrent.TimeoutException while sending data via WebSocket (Tomcat8 JSR-356). Refer the trace given below

java.io.IOException: java.util.concurrent.TimeoutException
    at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialString(WsRemoteEndpointImplBase.java:258)
    at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:193)
    at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)

I want to know if there are any circumstances under which we get this exception, apart from network latency related issues

Note : I'm facing this exception randomly. Tomcat version is 8.0.20

Upvotes: 1

Views: 1816

Answers (1)

Andre Brito
Andre Brito

Reputation: 146

I had the same issue and it was caused by sending data in chunks (Chunked transfer encoding or chunk streaming)

In my case was HTTP Post and the fix was sending content-length in headers.

But it may be the case that the receiver is not prepared to read data in chunks and thus times out waiting for EOF of data.

Upvotes: 1

Related Questions