He-Pin opened a new pull request, #3700: URL: https://github.com/apache/pekko/pull/3700
### Motivation `ClusterShardingGuardian` creates one `Replicator` per role as its own child and caches the `ActorRef`, but never watches it. The reachable stop path is the replicator stopping *itself* (`Replicator.receiveMemberRemoved`: self removed from the cluster, or `ClusterShuttingDown`). The stale ref stays in `replicatorByRole` and is handed out to every later caller, so remember-entities reads/writes and coordinator state propagation silently go to dead letters, with no log line pointing at the cause and no automatic re-creation. ### Modification - `ClusterShardingGuardian.replicator(...)`: `context.watch(ref)` when caching. - Handle `Terminated` in the guardian's receive and evict the cache entry, so the next `replicator(...)` call creates a fresh one. - New `ClusterShardingGuardianSpec`: starts sharding (ddata), poison-pills the replicator, starts another shard type and asserts a fresh, alive replicator is created (`GetKeyIds` answered). ### Result A stopped Replicator is no longer served from the per-role cache; the next sharding start recreates it. ### Tests - `sbt "cluster-sharding / Test / testOnly org.apache.pekko.cluster.sharding.ClusterShardingGuardianSpec"`: passed - Directional check: reverted the fix, re-ran — failed as expected (no replicator recreated, `ActorIdentity.ref` empty) - Full validation on CI ### References Fixes #3691 -- 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]
