# Event Loop Block

**URL:** <https://community.livekit.io/t/event-loop-block/2455>\
**Category:** Agents\
**Tags:** agent-development, sip-trunking\
**Created:** [November 5, 2026, 11:05am UTC](https://community.livekit.io/t/event-loop-block/2455 "2026-11-05T11:05:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![siddharthmot](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@siddharthmot](https://community.livekit.io/u/siddharthmot)\
**Post date:** [November 5, 2026, 11:05am UTC](https://community.livekit.io/t/event-loop-block/2455/1 "2026-11-05T11:05:37Z")

</div>

event loop blocked for 4355ms at \“/usr/local/lib/python3.14/ssl.py\”, line 1140, in read; synchronous work on the agent loop delays audio and turn handling, move it to a thread or an async client

Getting the above error, what should be the reason and what changes need to be made. Why suddenly getting this kind of error ? till yesterday it is working fine

---

<div class="post-metadata">

**Author:** ![darryncampbell](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/darryncampbell/32/20_2.png) [@darryncampbell](https://community.livekit.io/u/darryncampbell)\
**Post date:** [November 6, 2026, 9:10am UTC](https://community.livekit.io/t/event-loop-block/2455/2 "2026-11-06T09:10:50Z")

</div>

Hi, I don’t think it’s in the docs, but the feature was introduced here: [[Python](https://github.com/livekit/agents/pull/7128), [NodeJS](https://github.com/livekit/agents-js/pull/2541)]

I also did a little write up about it here: [https://livekit.com/blog/diagnosing-blocked-event-loops#if-the-immediate-cause-isnt-obvious](https://livekit.com/blog/diagnosing-blocked-event-loops#if-the-immediate-cause-isnt-obvious)

> LiveKit Agents watches its own event loop and reports every stall of 100ms or more

> [@siddharthmot](#):
>
> what should be the reason and what changes need to be made. Why suddenly getting this kind of error ? till yesterday it is working fine

_ **Something** _ is blocking your event loop, and the error message is pointing you to the line (there should also be an OTEL event). Why this suddenly started happening, I can’t say - it’s coming from your agent.

---

<div class="post-metadata">

**Author:** ![Rehan\_Sanjay\_Venkatesan](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/rehan_sanjay_venkatesan/32/2739_2.png) [@Rehan\_Sanjay\_Venkatesan](https://community.livekit.io/u/Rehan_Sanjay_Venkatesan)\
**Post date:** [November 8, 2026, 10:24am UTC](https://community.livekit.io/t/event-loop-block/2455/3 "2026-11-08T10:24:09Z")

</div>

@siddharthmot the file in that message is the useful clue. On Python 3.14, line 1140 of `ssl.py` is inside `SSLSocket.read`, a blocking TLS read. asyncio never does one of those itself; its own TLS goes through a different class. So something in your agent is calling a synchronous HTTPS client on the event loop and waiting about 4.3 seconds for the server to answer.

The usual culprits, inside a tool or a hook: `requests`, a sync `httpx.Client`, the sync `OpenAI()` client instead of `AsyncOpenAI()`, `boto3`, or a database driver connecting over TLS.

On why it started suddenly, two likely causes:

1. The call was always blocking, but the server it talks to got slower. The 4355ms is mostly the remote’s response time.
2. You picked up a newer livekit-agents. The blocked-loop report is fairly new, so if your requirements aren’t pinned to an exact version, a redeploy can switch on the warning with no change to your code. The blocking was there before; you just couldn’t see it.

To find the caller, look further up the stack for the first frame in your own code. The OTEL event Darryn mentioned carries it, or grep your agent for the clients above.

The fix is the async client (`AsyncOpenAI`, `httpx.AsyncClient`, `aiohttp`), or moving the call off the loop:

```python
result = await asyncio.to_thread(sync_call, arg)

```

Give it a timeout either way. While the loop is blocked, the agent can’t hear the caller, so 4 seconds is a long time on a call.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/system/32/26_2.png) [@system](https://community.livekit.io/u/system)\
**Post date:** [November 23, 2026, 10:24am UTC](https://community.livekit.io/t/event-loop-block/2455/4 "2026-11-23T10:24:45Z")

</div>

Closed on November 23, 2026, 10:24am UTC

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
