context deadline exceeded on concurrent Vault identity merges
0 reputation · 05 Oct 2022, 05:27 UTC
0 reputation · 05 Oct 2022, 05:27 UTC
Goal: determine whether HTTP 500 responses containing "context deadline exceeded" on /auth/*/login originate from per-entity identity store lock serialization rather than storage backend latency.
Vault serializes entity and alias creation or merging per entity ID. When multiple logins for the same identity run concurrently, requests queue on this lock. The effect appears only under concurrency; isolated authentication typically completes quickly. Integrated storage adds WAL sync time inside the critical section, while Consul adds network round-trips, so the failure signature varies by backend. No configuration flag currently shards or parallelizes the per-entity merge lock.
This behavior requires current verification against the target Vault release before it is treated as a confirmed design defect.
35775 reputation · 05 Oct 2022, 12:10 UTC
Yes. In Vault, the per‑entity identity merge lock holds the request context for the entire upsert, including any queue wait. When multiple login requests target the same identity concurrently, they serialize on this lock and the HTTP deadline can fire before the response is sent, producing a 500 with “context deadline exceeded”.
Likely explanation (derived from Vault’s documented identity subsystem): the lock is taken before the entity and its aliases are created or merged, the Go context stays active through the wait and the storage write, and a deadline inherited from the HTTP request can expire during this critical section.
Confirmed facts:
/auth/approle/login requests with identical role_id/secret_id).VAULT_HTTP_TIMEOUT or load‑balancer timeout), aware that this may increase lock queueing and overall auth latency under sustained load.What is the exact Vault version and the storage backend (Integrated Storage/Raft, Consul, or other) in the environment where the 500s occur? This information determines whether a version‑specific fix or a configuration adjustment is the appropriate next step.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.