\"/usr/local/lib/python3.13/asyncio/tasks.py\", li...
# ask-ai
i
\"/usr/local/lib/python3.13/asyncio/tasks.py\", line 507, in wait_for\n return await fut\n ^^^^^^^^^\n File \"/home/appuser/.local/lib/python3.13/site-packages/livekit/agents/ipc/channel.py\", line 47, in arecv_message\n return _read_message(await dplx.recv_bytes(), messages)\n ^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/appuser/.local/lib/python3.13 /site-packages/livekit/agents/utils/aio/duplex_unix.py\", line 35, in recv_bytes\n len_bytes = await self._reader.readexactly(4)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.13/asyncio/streams.py\", line 769, in readexactly\n await self._wait_for_data('readexactly')\n File \"/usr/local/lib/python3.13/asyncio/streams.py\", line 539, in _wait_for_data\n await self._waiter\nasyncio.exceptions.CancelledError\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/home/appuser/.local/lib/python3.13/site-packages/livekit/agents/cli/_run.py\", line 88, in _worker_run\n await worker.run()\n File \"/home/appuser/.local/lib/python3.13/site-packages/livekit/agents/worker.py\", line 408, in run\n await self._inference_executor.initialize()\n File \"/home/appuser/.local/l ib/python3.13/site-packages/livekit/agents/ipc/supervised_proc.py\", line 168, in initialize\n init_res = await asyncio.wait_for(\n ^^^^^^^^^^^^^^^^^^^^^^^\n ...<2 lines>...\n )\n ^\n File \"/usr/local/lib/python3.13/asyncio/tasks.py\", line 506, in wait_for\n async with timeouts.timeout(timeout):\n ~~~~~~~~~~~~~~~~^^^^^^^^^\n File \"/usr/local/lib/python3.13/asyncio/timeouts.py\", line 116, in __aexit__\n raise TimeoutError from exc_val\nTimeoutError
t
Thanks for reaching out, Nilanga. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
i
this happpend on fly.io
t
The
asyncio.exceptions.CancelledError
and
TimeoutError
you are encountering during LiveKit agent initialization are commonly caused by the supervised process failing to initialize within the configured timeout. This can stem from slow process startup, blocking or heavy operations during initialization, or resource limits being hit during startup. • Increase the initialization timeout in your
WorkerOptions
. For example:
Copy code
opts = WorkerOptions(
    initialize_process_timeout=30.0  # Increase from default 10.0
)
• Make sure the initialization function avoids heavy or blocking operations, as these can delay startup beyond the timeout period. • Check memory usage and limits during initialization. If processes are being killed due to memory constraints, increase the relevant memory limits in
WorkerOptions
. • For troubleshooting, enable detailed logging for the
livekit.agents
module. Adjusting the timeout is the most common and effective resolution. Review your deployment and initialization routines as well to ensure they are as lightweight as possible.