jersey icon indicating copy to clipboard operation
jersey copied to clipboard

Fix Netty for unsized large responses

Open brettkail-wk opened this issue 6 years ago • 0 comments

HttpChunkedInput needs to be flushed so that it can read input immediately. Otherwise, all writes are buffered until the response is fully written, which overflows the buffer if enough data is sent.

This only partially fixes the problem since clients that are reading slower than one chunk per 10sec can still overflow the buffer, but it is often sufficient in practice. To fully fix, JerseyChunkedInput needs to be reworked to block indefinitely when there's no space but to allow the ChunkedInput.close to awaken the writer and throw an IOException. (The existing close implements both the OutputStream and ChunkedInput, but it appears to be implemented as the latter only, so the removeLast/add appears to race with concurrent writes.)

Updates #3500

(I am listed for Jersey in the Oracle Contributor Agreement under "Workiva Inc.")

brettkail-wk avatar Mar 23 '18 11:03 brettkail-wk