kubeflow / kubeflow/docs-agent

bug(server): PyMilvus synchronous RPC commands freeze the ASGI event loop

Open
#82 2 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.