Skip to content

Issue 4503: Added check into BufferedChannel's read to avoid endless loop #4506

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

Merged
merged 4 commits into from
Feb 17, 2025

Conversation

StefanoBelli
Copy link
Contributor

Fix #4503

Motivation

As discussed in the referred issue, this PR aims to avoid the endless loop which will happen if the dest ByteBuf passed to the BufferedChannel's read has less remaining writable bytes than the amount of bytes required to read (read's "length" parameter)

Changes

Now, BufferedChannel.read() throws an exception if dest. buf. writableBytes is less than length

… buffer's remaining capacity is not as much as length
@hezhangjian
Copy link
Member

Thanks for your contribution. Could you please add a unit test for this change?

@StefanoBelli
Copy link
Contributor Author

Of course, I will add test cases to the existing BufferedChanelTests

@StefanoBelli
Copy link
Contributor Author

Hi, some time has passed since this pr opened and I recall that CI error was due to unability of wget to download a bk tar (maybe some backward compat tests) compressed archive from apache.org, just saying to allow you to rerun CI and then close this PR

@StevenLuMT StevenLuMT closed this Feb 15, 2025
@StevenLuMT StevenLuMT reopened this Feb 15, 2025
@StevenLuMT
Copy link
Member

reopen's reason: rerun failure checks

Copy link
Member

@StevenLuMT StevenLuMT left a comment

Choose a reason for hiding this comment

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

LGTM

@StevenLuMT StevenLuMT merged commit b8082f6 into apache:master Feb 17, 2025
42 of 45 checks passed
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.

BufferedChannel's read(ByteBuf, long, int) gets stuck in loop
4 participants