Fix "Operator has been terminated" #134
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #133
This branch corrects what appears to be unsupported usage of the Project Reactor API. Oracle R2DBC was combining Flux.concatDelayError with Flux.doOnCancel to trigger resource clean up upon termination with onComplete, onError, or cancel.
My understanding of Project Reactor is this:
If the (concatDelayError + doOnCancel) publisher receives onComplete, it stores a reference to reactor.core.Exceptions.TERMINATED. If this publisher then receives a cancel, it sees the reference to TERMINATED and reports it as a dropped error. The message of TERMINATED is "Operator has been terminated", which will appear in stderr or in log messages.
The fix is to simply to use the Flux.usingWhen method to trigger resource clean up. I believe this is the intended usage of the Project Reactor API, so it should serve us better than what we had before.