silly-dusk-24995
11/21/2025, 7:31 AMtall-airline-16756
11/21/2025, 7:31 AMtall-airline-16756
11/21/2025, 7:31 AMsilly-dusk-24995
11/21/2025, 7:32 AMtall-airline-16756
11/21/2025, 7:32 AMdelete_room from inside a long‑running background job or after shutting down your app’s aiohttp session? If the app closes its HTTP session or event loop before the delete call, you’ll get this error.
1. Ensure the LiveKit client/session is open when calling delete
• Keep the LiveKit/twirp client or underlying aiohttp session alive until the delete completes.
• If you create a client per job, create it just before the request and ensure you await the delete before closing the session.
1. Check your SDK usage after upgrade
• If the upgraded SDK changed client lifecycle (constructor, async init, or close behavior), adjust code to match the new pattern (initialize client/session and avoid premature close()).
• If you call any global shutdown/cleanup in finally blocks or signal handlers, ensure the delete runs before that cleanup.
1. Minimal code suggestions
• Create and use the client inside the coroutine that performs the delete, then close it after the call completes.
• Example pattern:
a. Initialize client/session
b. await client.room.delete_room(...)
c. Close client/session
1. If delete runs concurrently
• If multiple tasks share a single client/session, avoid one task closing the session while another is still using it. Use a single owner to close, or use an async lock to serialize close vs. use.
Next step: please share one of the following so I can give a precise code fix:
• The code snippet around client/session creation and where you call delete_room, or
• Which Python LiveKit SDK version you upgraded from/to and whether you changed client lifecycle code.
Would you like an example adjustment based on your snippet?