Skip to content

fix state update timeout for remember-entities - #6479

Merged
Aaronontheweb merged 1 commit into
akkadotnet:devfrom
Aaronontheweb:fix-6478-state-update-timeout
Mar 2, 2023
Merged

Aaronontheweb merged 1 commit into
akkadotnet:devfrom
Aaronontheweb:fix-6478-state-update-timeout

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Member

Changes

We were using the wrong state timeout value, which only gave us 2s to recover R-E data. We're now using the correct value.

Addresses part of #6478 but there's still an issue with shard backoff + recreation that isn't handled correctly.

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

We were using the wrong state timeout value, which only gave us 2s to recover R-E data. We're now using the correct value.
@Aaronontheweb
Aaronontheweb enabled auto-merge (squash) March 2, 2023 03:19
@Aaronontheweb
Aaronontheweb merged commit dde36e9 into akkadotnet:dev Mar 2, 2023
Aaronontheweb added a commit that referenced this pull request Sep 10, 2026
…ng-state-timeout, as the config documents; the read setting had been used since #6479

Shard.SendToRememberStore armed the remember-entities WRITE timeout with
TuningParameters.WaitingForStateTimeout (2s), while the exception it throws on
timeout, reference.conf's own doc comment for updating-state-timeout ("Also
used as timeout for writes of remember entities when that is enabled"), and
DDataRememberEntitiesShardStore's write-majority retry sizing (3 retries at
updating-state-timeout / 4) all agree the write should use
UpdatingStateTimeout (5s). Commit dde36e9 (#6479) swapped both the read and
write sites in one hunk but only described fixing the read path, leaving the
write path armed with the wrong, shorter timeout and giving the store's
retries zero time to run before the shard gave up and restarted, dropping any
buffered messages for the entity.

Restores UpdatingStateTimeout on the write arm; the read path (already using
UpdatingStateTimeout, more leniently than Pekko) is untouched. Adds
RememberEntitiesWriteTimeoutSpec, which fails on unpatched code (the shard
restarts and the buffered message is dropped) and passes with the fix (the
store's delayed-but-valid write ack arrives and no restart occurs).
Aaronontheweb added a commit that referenced this pull request Sep 10, 2026
…ng-state-timeout, as the config documents (#8574)

* Cluster.Sharding: arm the remember-entities write timeout with updating-state-timeout, as the config documents; the read setting had been used since #6479

Shard.SendToRememberStore armed the remember-entities WRITE timeout with
TuningParameters.WaitingForStateTimeout (2s), while the exception it throws on
timeout, reference.conf's own doc comment for updating-state-timeout ("Also
used as timeout for writes of remember entities when that is enabled"), and
DDataRememberEntitiesShardStore's write-majority retry sizing (3 retries at
updating-state-timeout / 4) all agree the write should use
UpdatingStateTimeout (5s). Commit dde36e9 (#6479) swapped both the read and
write sites in one hunk but only described fixing the read path, leaving the
write path armed with the wrong, shorter timeout and giving the store's
retries zero time to run before the shard gave up and restarted, dropping any
buffered messages for the entity.

Restores UpdatingStateTimeout on the write arm; the read path (already using
UpdatingStateTimeout, more leniently than Pekko) is untouched. Adds
RememberEntitiesWriteTimeoutSpec, which fails on unpatched code (the shard
restarts and the buffered message is dropped) and passes with the fix (the
store's delayed-but-valid write ack arrives and no restart occurs).

* RememberEntitiesFailureSpec: prove the write timeout fix with the existing fake store instead of a new spec

Deletes RememberEntitiesWriteTimeoutSpec.cs's standalone 180-line spec and its bespoke
delayed-ack store, replacing it with one fact on RememberEntitiesFailureSpec that reuses
the shared FakeStore/FakeShardStoreActor harness. The fact delays a remember-entities
write's ack by 3s (strictly between the 2s waiting-for-state-timeout and 5s
updating-state-timeout reference defaults) and asserts the buffered message is still
delivered and the shard does not restart.

FakeShardStoreActor's existing Delay failure mode replies to a delayed write with the
wrong payload type, so the write never actually completes - every existing Delay fact
only relies on that to force a timeout. Adds a new DelayedSuccess failure mode, additive
and reusing the same Delayed/timer plumbing, that acknowledges the write correctly so a
write can genuinely finish late but within its timeout - which the existing Delay mode
could not exercise.

Verified this fact discriminates: reverting Shard.cs's one-line fix by hand made it fail
(shard restarts at ~2s per the log, buffered message lost); restoring the fix made it
pass. All 26 facts in RememberEntitiesFailureSpec pass in three consecutive runs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant