agents icon indicating copy to clipboard operation
agents copied to clipboard

Sometime unable to receive task message from livekit server

Open Max-Thuc opened this issue 4 months ago • 0 comments

When testing, I notice that sometime the agent doesn't receive the task even when the load is under the threshold. I put the log and found that the websocket didn't receive the task message as well. I looked at your implementation and found a issue: In https://github.com/livekit/agents/blob/main/livekit-agents/livekit/agents/worker.py#L456 task, you use 1 async task for read and other async task for write from websocket. But in the documentation from the websocket library https://docs.aiohttp.org/en/stable/client_quickstart.html, it is listed that

You must use the only websocket task for both reading (e.g. await ws.receive() or async for msg in ws:) and writing but may have multiple writer tasks which can only send data asynchronously (by await ws.send_str('data') for example).

I think it means that you must use only 1 async task for both read and write. Please help to check and see if it is needed to fix it

Max-Thuc avatar Oct 04 '24 06:10 Max-Thuc