Remove redundant delaySubscription from FunctionConfiguration#2978
Merged
sobychacko merged 1 commit intospring-cloud:mainfrom Aug 1, 2024
Merged
Remove redundant delaySubscription from FunctionConfiguration#2978sobychacko merged 1 commit intospring-cloud:mainfrom
delaySubscription from FunctionConfiguration#2978sobychacko merged 1 commit intospring-cloud:mainfrom
Conversation
Related to: spring-projects/spring-integration#9362 After the fix in Spring Integration: spring-projects/spring-integration@bdcb856 we ended up in a deadlock situation with a `beginPublishingTrigger` in the `FunctionConfiguration` used for the `delaySubscription()` on an original `Publisher`. The `FluxMessageChannel` uses its own `delaySubscription()` until the channel has its subscribers. Apparently the logic before was with errors, so the `FluxMessageChannel` was marked as active even if its subscriber is not ready yet, leading to famous `Dispatcher does not have subscribers` error. So, looks like this `beginPublishingTrigger` was introduced back in days in Spring Cloud Stream to mitigate that situation until we really emit a `BindingCreatedEvent`. The deadlock (and the flaw, respectively) is with the `setupBindingTrigger()` method implementation where `FluxMessageChannel` now "really" delays a subscription to the provided `Publisher`, therefore not triggering that `Mono.create()` fulfilment immediately. The `BindingCreatedEvent` arrives earlier, than we have a subscriber on the channel, but `triggerRef.get()` is `null`, so we don't `success()` it and in the end don't subscribe to an original `Publisher` since `delaySubscription()` on it is never completed. Since `FunctionConfiguration` fully relies on `IntegrationFlow.from(Publisher)`, which ends up with the mentioned `FluxMessageChannel.subscribeTo()` and its own `delaySubscription()` (which, in turn, apparently fixed now), we don't need our own `delaySubscription()` any more. Therefore the fix in this PR is to propose to remove `beginPublishingTrigger` logic altogether.
sobychacko
approved these changes
Jul 29, 2024
Contributor
|
@artembilan @sobychacko Any update on the release date? |
Contributor
|
Hi, this will be part of the https://calendar.spring.io/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to: spring-projects/spring-integration#9362
After the fix in Spring Integration: spring-projects/spring-integration@bdcb856 we ended up in a deadlock situation with a
beginPublishingTriggerin theFunctionConfigurationused for thedelaySubscription()on an originalPublisher. TheFluxMessageChanneluses its owndelaySubscription()until the channel has its subscribers. Apparently the logic before was with errors, so theFluxMessageChannelwas marked as active even if its subscriber is not ready yet, leading to famousDispatcher does not have subscriberserror. So, looks like thisbeginPublishingTriggerwas introduced back in days in Spring Cloud Stream to mitigate that situation until we really emit aBindingCreatedEvent.The deadlock (and the flaw, respectively) is with the
setupBindingTrigger()method implementation whereFluxMessageChannelnow "really" delays a subscription to the providedPublisher, therefore not triggering thatMono.create()fulfilment immediately. TheBindingCreatedEventarrives earlier, than we have a subscriber on the channel, buttriggerRef.get()isnull, so we don'tsuccess()it and in the end don't subscribe to an originalPublishersincedelaySubscription()on it is never completed.Since
FunctionConfigurationfully relies onIntegrationFlow.from(Publisher), which ends up with the mentionedFluxMessageChannel.subscribeTo()and its owndelaySubscription()(which, in turn, apparently fixed now), we don't need our owndelaySubscription()any more. Therefore the fix in this PR is to propose to removebeginPublishingTriggerlogic altogether.