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

Fix buffer leak in HttpClientStreamTest.testUploadWithConcurrentServerCloseClosesStream() #10431

Conversation

lorban
Copy link
Contributor

@lorban lorban commented Aug 29, 2023

Depends on #10432 - so this PR is a branch of that other PR.

See #10226

@lorban lorban added Bug For general bugs on Jetty side Test labels Aug 29, 2023
@lorban lorban added this to the 12.0.x milestone Aug 29, 2023
@lorban lorban requested review from gregw and sbordet August 29, 2023 13:44
@lorban lorban self-assigned this Aug 29, 2023
joakime
joakime previously approved these changes Aug 29, 2023
@lorban
Copy link
Contributor Author

lorban commented Aug 29, 2023

This requires more investigations as stopping the connector should release any pending buffer not yet handed over to user code.

@lorban lorban force-pushed the fix/jetty-12-10226-testUploadWithConcurrentServerCloseClosesStream branch from 36be6fc to 56dbe8a Compare August 30, 2023 08:55
@lorban lorban requested a review from joakime August 30, 2023 08:55
@lorban lorban force-pushed the fix/jetty-12-10226-testUploadWithConcurrentServerCloseClosesStream branch from 5bf4077 to d3de838 Compare August 31, 2023 09:39
gregw
gregw previously approved these changes Sep 8, 2023
@lorban
Copy link
Contributor Author

lorban commented Sep 8, 2023

@sbordet nudge

@lorban lorban force-pushed the fix/jetty-12-10226-testUploadWithConcurrentServerCloseClosesStream branch 2 times, most recently from fb96bb9 to e290596 Compare September 11, 2023 07:35
Signed-off-by: Ludovic Orban <[email protected]>
Signed-off-by: Ludovic Orban <[email protected]>
@lorban lorban force-pushed the fix/jetty-12-10226-testUploadWithConcurrentServerCloseClosesStream branch from e290596 to dd3d6d7 Compare September 11, 2023 09:03
@lorban lorban force-pushed the fix/jetty-12-10226-testUploadWithConcurrentServerCloseClosesStream branch from dd3d6d7 to c4f4446 Compare September 11, 2023 09:52
@lorban
Copy link
Contributor Author

lorban commented Sep 11, 2023

On hold until #10277 is sorted.

@lorban
Copy link
Contributor Author

lorban commented Sep 12, 2023

The problem is that stopping the connector is notifying the HttpConnection via onClose, but that notification isn't reported to the channel state.

The tentative fix of releasing the buffer in onClose and ensuring the buffer only gets released once by making it atomic isn't right as HttpConnection's buffer shouldn't need any thread safety.

@lorban
Copy link
Contributor Author

lorban commented Apr 2, 2024

@sbordet nudge

Signed-off-by: Ludovic Orban <[email protected]>
…10226-testUploadWithConcurrentServerCloseClosesStream
Signed-off-by: Ludovic Orban <[email protected]>
@lorban lorban requested review from sbordet and gregw April 9, 2024 11:42
Signed-off-by: Ludovic Orban <[email protected]>
Signed-off-by: Ludovic Orban <[email protected]>
joakime
joakime previously approved these changes Apr 11, 2024
Copy link
Contributor

@joakime joakime left a comment

Choose a reason for hiding this comment

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

Anything holding back this from being merged?

@lorban
Copy link
Contributor Author

lorban commented Apr 12, 2024

@joakime not that I know. A final review pass from @sbordet would be preferable but I think I addressed all his concerns.

Signed-off-by: Ludovic Orban <[email protected]>
joakime
joakime previously approved these changes Apr 17, 2024
Signed-off-by: Ludovic Orban <[email protected]>
Signed-off-by: Ludovic Orban <[email protected]>
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.

Conditional approval... with one question

LOG.debug("onClose {} stream={}", this, _stream);

// If the channel doesn't have a stream, then no action is needed.
if (_stream == null)
Copy link
Contributor

Choose a reason for hiding this comment

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

would _request == null be a better test. Do we want an EofException if a connection is opened then closed without a request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used the _stream == null test for consistency with onFailure() that tests for that too, but in practice it's identical to _request == null as both are reset to null at the same place in recycle().

And I do believe it is correct to fail with a EofException when a connection is opened then immediately closed without sending a byte.

@sbordet Do you agree?

@lorban lorban merged commit 656e904 into jetty-12.0.x Apr 22, 2024
10 checks passed
@lorban lorban deleted the fix/jetty-12-10226-testUploadWithConcurrentServerCloseClosesStream branch April 22, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side Test
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Review read failures impacting writes
4 participants