A JSON chat answer blocks the backend event loop for the whole RAG run
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- backend, performance
Direzione di ricerca
Inizia da backend/ leggendo gli handler di POST /conversations/agent-retriever e POST /helpers/suggestedQuestions; l’issue descrive entrambe le chiamate bloccanti e la correzione proposta con run_in_threadpool. Usa la riproduzione descritta nell’issue con il grafo simulato e httpx.AsyncClient per verificare che /healthcheck risponda mentre viene generata una risposta JSON. Il lavoro è completato quando entrambi gli handler mantengono reattivo il loop degli eventi e la riproduzione è coperta da test di regressione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 51
- Fork
- 27
- Merge medio
- 11h 59m
- PR unite (30g)
- 33
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di The-OpenROAD-Project/ORAssistant
-
Rename a conversation from the sidebarForse già presa @NopeCharon l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 62/100
The-OpenROAD-Project/ORAssistant#659 ·
I maintainer di solito rispondono entro 1 giorno
-
Conversations from POST /conversations stay untitled and keep their creation timeForse già presa @NopeCharon l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
The-OpenROAD-Project/ORAssistant#655 ·
I maintainer di solito rispondono entro 1 giorno
-
centralized backend configAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
The-OpenROAD-Project/ORAssistant#186 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Deprecate GOOGLE_APPLICATION_CREDENTIALSForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
The-OpenROAD-Project/ORAssistant#155 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Add button to OR GUI for easy accessForse di nuovo libera @sparsh-karna l’ha presa 164 giorni fa e non c’è nessuna pull request aperta. Aperta
The-OpenROAD-Project/ORAssistant#152 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di The-OpenROAD-Project/ORAssistant
Issue simili
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorForse già presa @jejjohnson l’ha presa oggi. Apertatype:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
jejjohnson/integrix#144 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
finos/ai-governance-framework#459 ·
-
slurm: a case outcome nested too deep crashes status/collect instead of reading as no outcomeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
freelawproject/litigant-portal#1307 ·
I maintainer di solito rispondono entro 2 giorni