You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix SourceRef.Source and SinkRef.Sink non-idempotent property bug (#7895)
Implemented Lazy<T> to make both ISourceRef<T>.Source and ISinkRef<T>.Sink
properties idempotent. 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:
- SourceRefImpl<T>: Use Lazy<Source<T, NotUsed>> for thread-safe caching
- SinkRefImpl<T>: Use Lazy<Sink<T, NotUsed>> for thread-safe caching
- Lazy<T> uses default ExecutionAndPublication mode for thread safety
Impact:
- Eliminates race conditions from accidental property accesses (debugger,
logging, serialization, framework inspection)
- Prevents subscription timeouts caused by multiple stage instances
- Fixes intermittent ~30% failure rate in production workloads
- Double materialization (user error) still fails gracefully at actor
protocol level via ObserveAndValidateSender
Test Results:
- Before fix: Tests failed 25/25 times (100% failure rate)
- After fix: Tests passed 10/10 times (100% success rate)
Fixes#7895
0 commit comments