reactor-core icon indicating copy to clipboard operation
reactor-core copied to clipboard

Flux/Mono.usingWhen late resource memory leak (#3695)

Open mlozbin opened this issue 2 years ago • 2 comments

UsingWhen method may lead to a memory or resource leak of allocation was finished after the main pipeline was cancelled. This change assures that asyncCancel is always called even if deferred.

Fixes #3695.

mlozbin avatar Jan 16 '24 16:01 mlozbin

@mlozbin Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla avatar Jan 16 '24 16:01 pivotal-cla

@mlozbin Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla avatar Jan 16 '24 16:01 pivotal-cla

@mlozbin Thank you for signing the Contributor License Agreement!

pivotal-cla avatar Feb 20 '24 12:02 pivotal-cla

Thank you @mlozbin for the effort. Unfortunately, as highlighted in my comment in the original issue, this PR breaks existing functionality and can't be accepted in the current form. Let's work through the design first and decide if a change in the code is necessary.

chemicL avatar Feb 20 '24 13:02 chemicL

I reopened the PR hoping to run the CI and prove a point raised in the original issue, but there are two problems:

  • The PR fails the preliminary tests due to not having the license headers updated (./gradlew spotlessApply fixes that)
  • There are failing tests and removed tests which should remain in the codebase.

Most importantly, this PR removes tests that validate functionality that currently is supported. Perhaps not in a documented way, but this behaviour can be something users out there rely on. So this change can't go in a patch release and definitely not without a documented migration path. Luckily, while the removal happened in MonoUsingWhenTest class, they are still present in FluxUsingWhenTest class and fail with this PR:

  • FluxUsingWhenTest > lateFluxResourcePublisherIsCancelledOnCancel()
  • FluxUsingWhenTest > lateMonoResourcePublisherIsCancelledOnCancel()

In summary, in the current form, I'm discarding this PR, but I remain open to discussing the plan for both solving the issue you describe while giving the existing usage patterns either a migration path or keeping the current behaviour supported (my preferred option). Thank you @mlozbin for the work you did so far and I look forward to constructive discussion in the original issue.

chemicL avatar Feb 22 '24 14:02 chemicL