[v1.5] Fix SourceRef.Source and SinkRef.Sink non-idempotent property bug #7907
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.
Summary
This PR backports #7905 from
devtov1.5.This fixes issue #7895 by making both
ISourceRef<T>.SourceandISinkRef<T>.Sinkproperties idempotent usingLazy<T>. Previously, these properties created new stage instances on every access, causing race conditions where multiple instances would compete for the same handshake, leading to intermittent subscription timeouts.Changes
Files Modified:
.Sourceproperty idempotent usingLazy<Source<T, NotUsed>>.Sinkproperty idempotent usingLazy<Sink<T, NotUsed>>Implementation:
Tests Added
1.
SourceRef_Source_property_should_be_idempotent_issue_7895.Sourceproperty accesses return the same instance2.
SourceRef_multiple_materializations_cause_timeout_issue_7895Impact
What This Fixes:
SourceRefStageImplinstancesLazy<T>defaultExecutionAndPublicationmodeWhat Still Fails (As Designed):
ObserveAndValidateSenderTest Results
Technical Notes
Why
Lazy<T>?ExecutionAndPublicationmodeSerialization Compatibility:
Lazy<T>fields are not serialized (transient)InitialPartnerRefis serializedSourceRefImplis created with freshLazy<T>Fixes #7895
Backport of #7905