Blocking the event loop since 3.x ?
Author: vmaurinCreated Sep 1, 2026Updated Sep 9, 2026
Labelsbug
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
We run a service using a standard asyncio event loop, running various async code like aiokafka, redis (async) or aiohttp. After upgrading to 3.x version, we notice after a while symptoms that the event loop is blocked:
- timeout accessing redis
- timeout with the aiokafka coordinator/heartbeat co-routine
We tried using the default httpx2 client or httpx2 aiohttp client, but it doesn't solve the issue. Reverting to 2.54 solves the issue
Sorry to be so vague, we have nothing in our logs that could give a pointer to a more precise section of the code. We do use chat completion APIs, and structured output with Pydantic
To Reproduce
- Update to 3.x
- Wait few hours, the CPU usage is raising, symptom of blocked event loop appears
Code snippets
OS
Linux x86
Python version
Python v3.12.3
Library version
OpenAI v3.6.0
Source: openai/openai-python