A JSON chat answer blocks the backend event loop for the whole RAG run
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 85/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- backend, performance
調査の方向性
backend/から作業を始め、POST /conversations/agent-retrieverとPOST /helpers/suggestedQuestionsのハンドラーを読みます。issueでは、両方のブロッキング呼び出しと、run_in_threadpoolを使う修正案が説明されています。issueにあるモックグラフとhttpx.AsyncClientを使った再現手順で、JSON回答の生成中も/healthcheckが応答することを確認します。完了条件は、両方のハンドラーがイベントループの応答性を保ち、この再現手順を回帰テストでカバーすることです。
索引モデルが issue の本文から書いたものです。
説明
POST /conversations/agent-retriever is an async def endpoint. Without "stream": true, it runs the graph synchronously:
output = list(graph.graph.stream(inputs, stream_mode="updates"))
That call holds the event loop for the whole run: retrieval, reranking, and the LLM calls. Until the run ends, the backend answers no other request. The Docker image runs one uvicorn process, so meanwhile:
/healthcheckand/conversations/readywait. The compose healthcheck calls/healthcheckwith a 10 s timeout.- Other users' questions, the Next.js conversation list, and suggested questions wait, so concurrent questions are answered one at a time.
POST /helpers/suggestedQuestions has the same problem on a smaller scale: it calls the synchronous OpenAI client inside async def, and the Next.js app calls it after every answer.
The streaming path is not affected: it uses astream_events, which runs the sync graph nodes in worker threads.
Reproduce
From backend/, with the test setup in CONTRIBUTING.md: a mocked graph whose run takes 2 s (time.sleep(2) in stream), the conversations and healthcheck routers, and an httpx.AsyncClient over ASGITransport. Start a JSON answer, then sleep 0.2 s and call /healthcheck:
sleep(0.2) returned after 2.15s
healthcheck 200 answered 2.16s after the chat request started
Proposed fix
Run both blocking calls in a worker thread with run_in_threadpool, as FastAPI does for def endpoints. The graph then runs off the event loop in the JSON path, as it already does in the streaming path.
- 主要言語
- Python
- スター
- 51
- フォーク
- 27
- 平均マージ
- 11時間 59分
- マージ済み PR(30日)
- 33
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
The-OpenROAD-Project/ORAssistant のほかの issue
-
Rename a conversation from the sidebar対応中かも @NopeCharon が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 62/100
The-OpenROAD-Project/ORAssistant#659 ·
メンテナーはふだん 1 日以内に返信
-
Conversations from POST /conversations stay untitled and keep their creation time対応中かも @NopeCharon が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
The-OpenROAD-Project/ORAssistant#655 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
The-OpenROAD-Project/ORAssistant#186 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Deprecate GOOGLE_APPLICATION_CREDENTIALS再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
The-OpenROAD-Project/ORAssistant#155 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Add button to OR GUI for easy access再び着手できるかも @sparsh-karna が 164 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
The-OpenROAD-Project/ORAssistant#152 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
The-OpenROAD-Project/ORAssistant の issue をすべて見る
似ている issue
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionError対応中かも @jejjohnson が今日担当しました。 オープンtype:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
jejjohnson/integrix#144 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
finos/ai-governance-framework#459 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
freelawproject/litigant-portal#1307 ·
メンテナーはふだん 2 日以内に返信