He-Pin opened a new pull request, #3346:
URL: https://github.com/apache/pekko/pull/3346

   ### Motivation
   
   When the materializer running a `BroadcastHub.sink` is shut down (e.g. the 
hosting actor stops or crashes), consumers materialized on a different 
materializer are not reliably notified of the hub's termination. The consumer 
source hangs indefinitely — neither `Completed` nor `Error` is received. See 
#3345.
   
   ### Modification
   
   - Move registered-consumer (`consumerWheel`) notification from 
`onUpstreamFailure` to `postStop` so that `postStop` is the single notification 
point for all consumers.
   - `postStop` now handles both `Open` (normal termination) and `Closed` 
(after upstream failure) states, ensuring registered consumers in the wheel 
always receive the appropriate signal.
   
   **Before:** `onUpstreamFailure` iterated the `consumerWheel` to notify 
registered consumers, but `postStop` did not. This left a gap where 
late-registering consumers could miss notification during materializer shutdown.
   
   **After:** `postStop` is the sole notification point for registered 
consumers, using the failure reason from the `Closed` state when applicable.
   
   ### Result
   
   BroadcastHub consumers are reliably notified when the hub's materializer 
shuts down, preventing consumers from hanging indefinitely.
   
   ### Tests
   
   - `sbt "stream-tests / Test / testOnly 
org.apache.pekko.stream.scaladsl.HubSpec"` — 51 passed, 0 failed
   - Added new test: `"notify consumers when hub materializer is shut down"`
   
   ### References
   
   Fixes #3345


-- 
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]

Reply via email to