You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2026/10/23 00:42:04 UTC
[PR] fix: report the effective timeout in shard hand off stop warnings [pekko]
pjfanning opened a new pull request, #3644:
URL: https://github.com/apache/pekko/pull/3644
### Motivation
During shard hand off, `Shard` reduced `hand-off-timeout` by 5 seconds (minimum 1 second) before passing it to
`HandOffStopper`, which then logged that reduced value as the hand off timeout. The early warning also said it would
wait the full timeout again although only the remainder was left, and the warning timer was not cancelled when the
stop timeout fired first.
### Modification
- `Shard` passes the configured `hand-off-timeout` to `HandOffStopper`, which derives the entity stop timeout itself.
- The early warning logs the remaining wait time.
- The warning timer is cancelled when the stop timeout fires.
- `ClusterShardingInternalsSpec` expectations widened, since the `HandOffStopper` entity stop timeout is now at
least 1 second.
### Result
Hand off warnings report accurate timeouts. The effective entity stop timeout used during hand off is unchanged.
### Tests
Not run locally - left to CI
### References
Ported from (Apache-2.0 since 2026-10-23):
- https://github.com/akka/akka-core/pull/32181
### Notes for reviewers
- No change in effective behaviour for the shard: entities are still force stopped after `hand-off-timeout - 5s`
(min 1s). Direct users of the internal `HandOffStopper` now get that reduction applied inside the actor, so a
value below 1 second is raised to 1 second.
- `HandOffStopper` is `@InternalApi private[pekko]`; signatures are unchanged, no MiMa excludes.
- No config changes, no wire format changes.
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] fix: report the effective timeout in shard hand off stop warnings [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #3644:
URL: https://github.com/apache/pekko/pull/3644#discussion_r4355860977
##########
cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ClusterShardingInternalsSpec.scala:
##########
@@ -98,10 +98,11 @@ class ClusterShardingInternalsSpec extends PekkoSpec("""
val handOffStopper = system.actorOf(
Props(new HandOffStopper(typeName, shard, probe.ref, Set(emptyHandlerActor), HandOffStopMessage, 10.millis)))
+ // the entity stop timeout is at least 1 second
Review Comment:
The production fix looks correct, but increasing this upper waiting limit also accepts the old behavior. Please add a directional regression that asserts the corrected remaining-time warning and cancellation of the pending warning in `ShardRegion.scala:566,576`, preferably with controlled scheduling. The regression should expose the original issue.
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] fix: report the effective timeout in shard hand off stop warnings [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #3644:
URL: https://github.com/apache/pekko/pull/3644
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] fix: report the effective timeout in shard hand off stop warnings [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #3644:
URL: https://github.com/apache/pekko/pull/3644#discussion_r4357999834
##########
cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/ClusterShardingInternalsSpec.scala:
##########
@@ -98,10 +98,11 @@ class ClusterShardingInternalsSpec extends PekkoSpec("""
val handOffStopper = system.actorOf(
Props(new HandOffStopper(typeName, shard, probe.ref, Set(emptyHandlerActor), HandOffStopMessage, 10.millis)))
+ // the entity stop timeout is at least 1 second
Review Comment:
Added `HandOffStopperSpec` in 4353dd08bf. It drives the timers with `ExplicitlyTriggeredScheduler` and checks the published warnings:
- With a 20s hand-off-timeout, the 5s warning must say `Waiting additional [10 seconds]`, and the entities must be stopped after 15s.
- With a 6s hand-off-timeout, the stop timeout fires after 1s. The entity blocks in `postStop`, so the stopper is still running when the 5s warning would be due, and no warning may be logged.
Against the old `HandOffStopper`, both tests fail. With only `timers.cancel(StopTimeoutWarning)` removed, the second fails and the leaked warning says `Waiting additional [-4 seconds]`. I kept the widened waits in `ClusterShardingInternalsSpec`, since the stop timeout is now at least 1s. The branch is also rebased onto main.
--
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: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org