eager-crowd-1678
07/08/2025, 10:24 AM2025-07-08 15:52:41,374 - ERROR livekit.agents - error initializing process {"pid": 11729}
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/livekit/agents/ipc/channel.py", line 47, in arecv_message
return _read_message(await dplx.recv_bytes(), messages)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/livekit/agents/utils/aio/duplex_unix.py", line 35, in recv_bytes
len_bytes = await self._reader.readexactly(4)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/streams.py", line 752, in readexactly
await self._wait_for_data('readexactly')
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/streams.py", line 545, in _wait_for_data
await self._waiter
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/livekit/agents/ipc/proc_pool.py", line 167, in _proc_spawn_task
await proc.initialize()
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/livekit/agents/ipc/supervised_proc.py", line 168, in initialize
init_res = await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
async with timeouts.timeout(timeout):
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
raise TimeoutError from exc_val
TimeoutError
tall-airline-16756
07/08/2025, 10:24 AMtall-airline-16756
07/08/2025, 10:24 AMconnect_timeout
, read_timeout
, and any API-specific timeouts related to Google STT, TTS to allow more time for the processes to establish connections.
• Check Network Connectivity: Ensure your network connection is stable and DNS/firewall settings allow communication with Google APIs.
• Resource Utilization: Monitor your system resources (CPU, memory, disk I/O) to ensure there's no resource exhaustion causing delayed responses.
• Review Error Handling: Make sure your setup can properly retry or recover from transient errors like timeouts.
• Inspect Logs: Check detailed logs for other errors or patterns that may indicate the root cause. Increasing log verbosity during initialization can help.
• Update Dependencies: Ensure you have the latest LiveKit agents and related libraries installed to incorporate known fixes.
Following these steps should help identify and resolve the cause of the TimeoutError you are seeing.eager-crowd-1678
07/08/2025, 11:37 AMtall-airline-16756
07/08/2025, 11:37 AMping_interval
and ping_timeout
, you can fine-tune how responsive your processes are.
The best part? You can customize these timeouts when you're setting up SupervisedProc
or ProcPool
to perfectly match what your specific environment needs. Pretty cool, right?eager-crowd-1678
07/08/2025, 11:38 AMtall-airline-16756
07/08/2025, 11:38 AMSupervisedProc
or ProcPool
in LiveKit. It's super easy!
For SupervisedProc
, you can do something like this:
proc = SupervisedProc(
initialize_timeout=30.0, # Timeout in seconds
close_timeout=10.0,
memory_warn_mb=512,
memory_limit_mb=1024,
ping_interval=1.0,
ping_timeout=5.0,
high_ping_threshold=0.5,
mp_ctx=mp_context,
loop=event_loop
)
And if you're using ProcPool
, the process is just as straightforward:
pool = ProcPool(
initialize_process_fnc=initialize_fn,
job_entrypoint_fnc=entrypoint_fn,
num_idle_processes=2,
initialize_timeout=30.0, # Timeout in seconds
close_timeout=10.0,
inference_executor=None,
job_executor_type=JobExecutorType.PROCESS,
mp_ctx=mp_context,
memory_warn_mb=512,
memory_limit_mb=1024,
loop=event_loop
)
Pro tip: Just tweak that initialize_timeout
float value (in seconds) to match how long you think your initialization will take. It's totally customizable!