Fix Shard remember-entities flag mismatch causing entity restart failures#8054
Merged
Aaronontheweb merged 2 commits intoakkadotnet:devfrom Feb 25, 2026
Merged
Conversation
…ures The Shard constructor derived _rememberEntities from whether a provider was passed, but passed settings.RememberEntities (from HOCON config) to the Entities class. When a provider was supplied without the config flag, the Entities._remembering set was never populated. This caused OnUpdateDone to see no pending work and overwrite the WaitingForRememberEntitiesStore behavior with Idle, dropping the subsequent UpdateDone from the store and preventing entity restarts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Shard.cswhere theEntitiesclass was initialized withsettings.RememberEntities(from HOCON config, defaultfalse) instead of_rememberEntities(derived from whether arememberEntitiesProviderwas passed to the constructor)Entities._rememberingHashSet to never be populated, soOnUpdateDonewould see no pending work and incorrectly transition the shard toIdlewhile a store write was in-flightUpdateDoneprevented entity restarts after transient failures (constructor/PreStart exceptions), causing theShardEntityFailureSpectest to flakeRoot Cause
The
Shardconstructor had two independent "remember entities enabled" flags:_rememberEntities = rememberEntitiesProvider != null(true when provider passed)Entities.RememberingEntities = settings.RememberEntities(from HOCON config)When a
rememberEntitiesProviderwas supplied without the config flag being set,PassivateCompletedwould trigger a store write andContext.Become(WaitingForRememberEntitiesStore), but thenOnUpdateDone's pending check against the empty_rememberingset would overwrite this withContext.Become(Idle), causing subsequentUpdateDonemessages to be dropped with "Id must not be empty".Test plan
ShardEntityFailureSpecpasses (bothConstructorFailActorandPreStartFailActorvariants)