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

Fixes #12227 - Improve HttpConnection buffer recycling. #12237

Merged

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Sep 4, 2024

Alternative to #12228.

In this PR, the responsibility to release the buffers is in 2 methods: onFillable() (called when network data is available, and to process the next request) and parseAndFillForContent() (called from Request.read()).

Alternative to #12228.

In this PR, the responsibility to release the buffers is in 2 methods: onFillable() (called when network data is available, and to process the next request) and parseAndFillForContent() (called from Request.read()).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

I agree with the approach taken.... just now play whack-a-bug until it works

sbordet and others added 3 commits September 5, 2024 00:07
Using the request executor to dispatch onFillable().

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Ensure there is a request before accessing components
Release buffer after consumeAvailable
@gregw
Copy link
Contributor

gregw commented Sep 5, 2024

@sbordet I've been playing whack-a-bug with this, but getting closer....

@gregw
Copy link
Contributor

gregw commented Sep 5, 2024

@sbordet org.eclipse.jetty.test.client.transport.HttpClientIdleTimeoutTest#testRequestIdleTimeout is currently failing because when it idle times out, consumeAvailable is called, which calls parseAndFillForContent, which makes the assumption that if it gets to content end state, then something will call onFillable to do the release. But that is not the case because we are already in the failure mechanism and that is why consumeAvailable has been called. So nothing releases the request buffer.

If I try to add a release in consumeAvailable or parseAndFillForContent then I get NPEs for the cases that think they do need to release the request buffer, but it has already been released.

…ary.

Fixed failing tests that were not completing the Handler Callback.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet
Copy link
Contributor Author

sbordet commented Sep 5, 2024

@gregw I think the current handling is correct.

It is the test that does not complete the Handler callback, and the check for leaks is performed before the server stops.

I pushed a fix to the tests to complete the callback, and the tests locally pass for me.

@gregw gregw self-requested a review September 5, 2024 12:31
@gregw gregw merged commit 6887435 into jetty-12.0.x Sep 6, 2024
10 checks passed
@gregw gregw deleted the fix/jetty-12.0.x/12227/httpconnection-buffer-recycling branch September 6, 2024 04:11
sbordet added a commit that referenced this pull request Sep 9, 2024
Just improving the test code.
The flakyness was likely fixed by the work in #12216 and #12237.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
sbordet added a commit that referenced this pull request Sep 10, 2024
Just improving the test code.
The flakyness was likely fixed by the work in #12216 and #12237.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
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