Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Fix Netty for unsized large responses #3790

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brettkail-wk
Copy link

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.")

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.)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant