pjfanning opened a new pull request, #3733: URL: https://github.com/apache/pekko/pull/3733
### Motivation `Shard` released its lease in `postStop` and discarded the returned `Future`, so a release that failed or returned `false` was never logged. The shard's next allocation then stalls until the lease times out, and the logs don't say why. This is the same problem as #3685, which #3699 fixes for `ClusterSingletonManager`. ### Modification - `Shard.postStop` now calls a `releaseLease()` helper. It logs an error from the future's callback when the release fails or returns `false`. The `ActorLogging` adapter is thread-safe, so it is fine to use after the actor stops. - A `release()` that throws synchronously is captured with `Try`, so the rest of `postStop` still runs. - Added `TestLease.setNextReleaseResult`. It is identical to the version in #3699, so whichever PR merges second only needs a trivial merge. ### Result When a shard stops and its lease is not released, an error naming the type and shard id is logged. ### Tests - `sbt "cluster-sharding/testOnly org.apache.pekko.cluster.sharding.ShardWithLeaseSpec"`: 8 passed. The 3 new cases (release returns false, release future fails, release throws) fail without the `Shard` change. - scalafmt run on the changed files. ### References Fixes #3705 -- 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]
