access: a degraded State Store pastes one round-trip onto every authorization decision #1275

Closed
opened 2026-10-27 13:39:44 +00:00 by sam · 0 comments
Owner

The version-checked chain (archie-core-i0scw) reads the policy revision before every Authorize. When the store is alive but slow, each decision waits up to versionTimeout (5s, internal/infrastructure/access/live.go), and dispatch evaluates up to 100 captures x armed bindings sequentially per cycle, so one degraded dependency can stretch a dispatch cycle from milliseconds to minutes. Fail-closed is the right answer to unreadable; the gap is that there is no bound on the total time a cycle spends asking.

Done when a store that is slow-but-answering cannot multiply a cycle's duration by the decision count — e.g. one version read per cycle or per task start rather than per decision, or a short-lived negative cache with a deadline measured from the first failure (not a TTL on a successful read, which would reintroduce the staleness bug).

Notes

Correction to the description: the '100 decisions per cycle' figure is wrong. bindingDispatchBatchLimit caps CAPTURES fetched per pass (daemon.go:467,529), not decisions; decisions are captures x armed bindings matching each capture's source (daemon.go:556,617), typically a couple per event and one pass per 60s by default. The stacked-5s scenario is also close to unreachable: ListUndispatchedCaptures runs earlier in the same pass against the same store, so a hung store logs and returns before any decision. The real residual is one single-row PK select per decision on a path that already makes three store calls per pass. Keep this only if a version read per cycle or per task start turns out to be cheaper in practice; otherwise close it as noise.

Close reason

Not a defect: the per-decision read is the design the maintainer wants — the database is the authority and the in-process engine is only a cache of it, kept current by the revision check. Closed as noise; reopen only if a measured store cost shows up.


Imported from beads archie-core-cxbe3 · GitHub #1847 · type task · priority P3 · created 2026-10-25 · closed 2026-10-25

The version-checked chain (archie-core-i0scw) reads the policy revision before every Authorize. When the store is alive but slow, each decision waits up to versionTimeout (5s, internal/infrastructure/access/live.go), and dispatch evaluates up to 100 captures x armed bindings sequentially per cycle, so one degraded dependency can stretch a dispatch cycle from milliseconds to minutes. Fail-closed is the right answer to unreadable; the gap is that there is no bound on the total time a cycle spends asking. Done when a store that is slow-but-answering cannot multiply a cycle's duration by the decision count — e.g. one version read per cycle or per task start rather than per decision, or a short-lived negative cache with a deadline measured from the first failure (not a TTL on a successful read, which would reintroduce the staleness bug). ### Notes Correction to the description: the '100 decisions per cycle' figure is wrong. bindingDispatchBatchLimit caps CAPTURES fetched per pass (daemon.go:467,529), not decisions; decisions are captures x armed bindings matching each capture's source (daemon.go:556,617), typically a couple per event and one pass per 60s by default. The stacked-5s scenario is also close to unreachable: ListUndispatchedCaptures runs earlier in the same pass against the same store, so a hung store logs and returns before any decision. The real residual is one single-row PK select per decision on a path that already makes three store calls per pass. Keep this only if a version read per cycle or per task start turns out to be cheaper in practice; otherwise close it as noise. ### Close reason Not a defect: the per-decision read is the design the maintainer wants — the database is the authority and the in-process engine is only a cache of it, kept current by the revision check. Closed as noise; reopen only if a measured store cost shows up. --- _Imported from beads `archie-core-cxbe3` · GitHub #1847 · type task · priority P3 · created 2026-10-25 · closed 2026-10-25_
sam added the lowtask labels 2026-10-27 13:39:44 +00:00
sam self-assigned this 2026-10-27 13:39:44 +00:00
sam closed this issue 2026-10-27 13:39:44 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1275