kubeflow / kubeflow/docs-agent
bug(server): PyMilvus synchronous RPC commands freeze the ASGI event loop
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 42
- Forks
- 111
- Avg merge
- 6d 23m
- Merged PRs (30d)
- 2
Description
Problem
In both server/app.py and server-https/app.py, the milvus_search() function executes PyMilvus gRPC calls (connections.connect(), collection.load(), collection.search()). Because these are synchronous, I/O-bound methods and they are called directly within an async def context without being wrapped in asyncio.to_thread or a thread pool, they block the entire ASGI event loop.
This causes the entire server to freeze under concurrent connections.
- Note: This is distinct from Issue #28 (connection pooling), which addresses how many connections are opened. This issue addresses what thread those connections run on to prevent event loop starvation.
Proposed Solution
Refactor milvus_search() to wrap the PyMilvus executions in await asyncio.to_thread(<blocking_call>, *args).
Related
- Distinct from #28 (Connection pooling)
- Distinct from #75 (httpx client lifespan)
- GSoC Pre-work: Part of codebase cleanup.
- Tracker: #72
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with milvus_search() in server/app.py and server-https/app.py, focusing on the synchronous PyMilvus calls named in the issue: connections.connect(), collection.load(), and collection.search(). Confirm that these executions are moved off the ASGI event loop, then verify that concurrent connections no longer freeze the server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100