-
-
Notifications
You must be signed in to change notification settings - Fork 16.1k
HttpContentDecoder must continue read when it did not produce any mes… #8922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…sage and auto read is false Motivation: When HttpContentDecoder (and so HttpContentDecompressor) does not produce any message we need to make sure it calls ctx.read() if auto read is false to not stale. Modifications: - Keep track if we need to call ctx.read() or not - Add unit test Result: Fixes #8915.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this part of MessageToMessageDecoder?
try { | ||
decodeContent(c, out); | ||
} finally { | ||
if (!needRead) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this variable handling is inverted. needRead
should start as true
, and if !out.isEmpty()
it should be set to false
. Then in channelReadComplete() it should be set to true
again.
If a read() causes three ByteBufs to be read (because using DefaultMaxBytesRecvByteBufAllocator), which calls decode() three times, the first two times may not put anything in out
but the last decode does place something in out
. It seems in that case we shouldn't call read.
But there's also the case where the second bytebuf placed something in out
. That seems like it shouldn't call read either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ejona86 sure why not.
@ejona86 its not mark of |
I can confirm too that #8915 is fixed by these changes. I have also understood now how the |
…sage and auto read is false
Motivation:
When HttpContentDecoder (and so HttpContentDecompressor) does not produce any message we need to make sure it calls ctx.read() if auto read is false to not stale.
Modifications:
Result:
Fixes #8915.