He-Pin opened a new pull request, #3024: URL: https://github.com/apache/pekko/pull/3024
### Motivation Addresses issue #17997 - Clarify stream closing semantics for bidirectional components. When a bidirectional component is about to finish, completing the downstream side (regularly or with an error) can race against cancelling the upstream side. If the cancellation arrives first, the error signal is lost because the connection is already cancelled. ### Modification - Added new strategy to - This strategy first completes all output ports, then waits for a grace period to allow the error to propagate through the counterpart, and finally cancels all input ports - Added Java API method - Added comprehensive tests to verify the new behavior - The strategy prevents race conditions in BidiFlow stacks where error propagation is important ### Result - Bidirectional components can now gracefully shut down by completing outputs first - Error signals have a chance to propagate through the counterpart before upstream cancellation - Addresses the race condition described in akka/akka-core#17997 ### Tests - stream-tests / Test / testOnly org.apache.pekko.stream.scaladsl.CancellationStrategySpec: All 15 tests passed ### References - Fixes akka/akka-core#17997 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
