fix(ateapi): add store fallback in ActorIdentity to resolve test flakiness - #1113
Open
shrutiyam-glitch wants to merge 2 commits into
Open
fix(ateapi): add store fallback in ActorIdentity to resolve test flakiness#1113shrutiyam-glitch wants to merge 2 commits into
shrutiyam-glitch wants to merge 2 commits into
Conversation
Collaborator
If we're failing through commonly ... maybe we shouldn't even be using it? I haven't had a chance to dig yet, but IIRC Zoe Zhao (@zoez7) was moving actor out of CRD => substrate API? |
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.
Fix
TestDurableDirLifecycleflaky testhttps://github.com/agent-substrate/substrate/actions/runs/32416349094/job/96578260374
Cause:
_suspend_from_PAUSED), the actor is suspended (which strips its worker assignment, returning the worker to the pool) and then immediately resumed.ResumeActor, the control plane selects a new worker, writes the assignment to the Kubernetes database, and synchronously makes a direct gRPC Restore() call to the atelet on that new worker.ateletboots the actor andatunnel.atunnelthen immediately asks theateapi(via theActorIdentityservice) to mint an actor certificate so it can connect to the network.Race: The
ActorIdentityservice verifies that the worker is actually assigned to the actor by checking its internalworkercache.Cache. However, this cache is powered by Kubernetes Informers, which receive updates asynchronously. BecauseResumeActorwas so fast, the cache hasn't processed the new worker assignment yet.The
ActorIdentityservice looks at the stale cache, sees the worker is unassigned, and hard-rejects the certificate minting with caller is not permitted to mint credentials for this actor.I faced this issue too when working on the postgresql updateWorker optimization (#934)
Fix: Updated
authorizeActorinsidecmd/ateapi/internal/actoridentity/actoridentity.go.Now, if
authorizeActorfails an authorization check (like discovering a missing or mismatched worker assignment), it will automatically do a one-time "live fetch" bypass (s.store.GetWorker()) directly against the primary store to bypass the lagging informer cache.