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

http-netty: fix JavaNetSoTimeoutHttpConnectionFilter leak #3043

Conversation

bryce-anderson
Copy link
Contributor

@bryce-anderson bryce-anderson commented Aug 13, 2024

Motivation:

There is a resource leak in the JavaNetSoTimeoutHttpConnectionFilter
rooted in the use of the ambWith(..) operator: if the response channel
loses the race with the timer the resulting response will be dropped on
the floor along with it's hot payloadBody().

Modifications:

Replace the ambWith with a custom operator that gives us the ability
to cleanup a losing response while also giving us the correct latching
behavior between cancellation, timeout, and response pathways.

@bryce-anderson bryce-anderson force-pushed the bl_anderson/JavaNetSoTimeoutHttpConnectionLeakFix branch from 8ccfdff to 38adcda Compare August 14, 2024 15:22
@bryce-anderson bryce-anderson force-pushed the bl_anderson/JavaNetSoTimeoutHttpConnectionLeakFix branch from 38adcda to 882cec8 Compare August 14, 2024 15:30
@bryce-anderson bryce-anderson changed the title WIP: fix JavaNetSoTimeoutHttpConnectionFilter leak http-netty: fix JavaNetSoTimeoutHttpConnectionFilter leak Aug 14, 2024
@bryce-anderson bryce-anderson marked this pull request as ready for review August 14, 2024 16:55
Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

Sorry for the back and forth on the error handling code, got additional context from Scott on chat:

Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

Last comments:

Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

Thank you!

@bryce-anderson bryce-anderson merged commit 44a5b80 into apple:main Aug 22, 2024
11 checks passed
@bryce-anderson bryce-anderson deleted the bl_anderson/JavaNetSoTimeoutHttpConnectionLeakFix branch August 22, 2024 15:18
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