Skip to content
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

Ensure we will call read() if nothing was decoded and AUTO_READ is no… #88

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

normanmaurer
Copy link
Member

…t used

Motivation:

We should ensure we call ctx.read() if the codec received a message to decode but did not produce anything and AUTO_READ is set to false. Failing to do so might result in stales as the user will not know that more reads are needed to make progress. This is inline with what ByteToMessageDecoder does under the hood

Modifications:

  • Change OHttpClientCodec and OHttpServerCodec to issue reads to make progress
  • Add unit test

Result:

Ensure reads are submitted when needed and so no stales happen

…t used

Motivation:

We should ensure we call `ctx.read()` if the codec received a message to decode but did not produce anything and AUTO_READ is set to false. Failing to do so might result in stales as the user will not know that more reads are needed to make progress. This is inline with what ByteToMessageDecoder does under the hood

Modifications:

- Change OHttpClientCodec and OHttpServerCodec to issue reads to make progress
- Add unit test

Result:

Ensure reads are submitted when needed and so no stales happen
@normanmaurer normanmaurer added this to the 0.0.17.Final milestone Sep 25, 2024
Copy link
Collaborator

@thomdev thomdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, except the missing piece i pointed out in the comment.

I am wondering if this logic should be moved to MessageToMessageDecoder and MessageToMessageCodec (which could just override channelReadComplete() and call decoder.channelReadComplete()). Is there a reason why ByteToMessageDecoder is doing it and not MessageToMessageDecoder? Is it because the former is using a cumulation buffer?

@normanmaurer
Copy link
Member Author

Change looks good, except the missing piece i pointed out in the comment.

I am wondering if this logic should be moved to MessageToMessageDecoder and MessageToMessageCodec (which could just override channelReadComplete() and call decoder.channelReadComplete()). Is there a reason why ByteToMessageDecoder is doing it and not MessageToMessageDecoder? Is it because the former is using a cumulation buffer?

The problem is that people might have extended these and marked them '@sharable'. When adding the same instance it will not work correctly

Copy link
Collaborator

@thomdev thomdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@normanmaurer normanmaurer merged commit 1bede5d into main Sep 25, 2024
9 checks passed
@normanmaurer normanmaurer deleted the no_auto_read branch September 25, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants