Streamed/Chunked proxying intermittently failing with play WS due to closed transfer on response

(Marco) #1


We have one controller (Play 2.7) that acts as a proxy to other services, and we use the WSClient (underlying AsyncHttpClient) to make the proxied requests (via If we load the entire response into memory immediately (response.bodyAsBytes) everything works fine. However if we stream or chunk the response as a Source (of ByteString), 50% of requests will fail on curl with “transfer closed with outstanding read data remaining” for chunked (translates to ERR_INCOMPLETE_CHUNKED_ENCODING for node.js clients) or “transfer closed with xxx bytes remaining to read” for streamed responses, regardless of whether akka or netty is used as http backend. Our proxied server is a Vert.x backend, and I assume some sensitive timeout (or missing/erroneous header) is responsible for the disconnect when brokering the chunked/streamed response from the proxied server back to the requesting client.

(Aditya Athalye) #2

In case you havent done so, You might want to check on the akka server request timeouts, so timeouts and such.

Also I would do one or more of the following:

1.) Turn on sys property for all network on the server.
2.) Check for any uncaught exceptions on the server which may be causing writes to fail in between.
3.) Check the TCP comm using wireshark etc.