Worker panics (FFI Panic: ReadyForRoomEventRequest timeout) when two jobs' ctx.connect() run concurrently, killing all jobs on the worker
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
Start with the minimal JobContext-only entrypoint in the issue and reproduce using two lk dispatch create calls to different rooms about a second apart. Then trace ctx.connect() and the room-connection path around the ReadyForRoomEventRequest timeout. Done means both jobs connect concurrently without a worker panic or a permanent hang, and both remain active.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Worker process crashes with a native FFI panic when two jobs' ctx.connect() calls happen within ~1 second of each other in the same worker. This reliably kills every active job on that worker, including ones that were already connected and running fine.
Tested with a non-conversational, JobContext-only entrypoint (no AgentSession, no voice pipeline) — a "programmatic participant" per the docs pattern in Job lifecycle. Repro does not require any real media/webcam — just two lk dispatch create calls to two different rooms a second apart.
Environment
livekit-agents1.8.3livekit(rtc/ffi) 1.1.18- OS: Windows 11
- Python 3.13.3
- Reproduced with both
lk agent devandlk agent start(i.e. not dev-mode-specific)
Minimal repro entrypoint
from livekit.agents import AgentServer, AutoSubscribe, JobContext, cli
server = AgentServer()
@server.rtc_session(agent_name="my-agent")
async def my_agent(ctx: JobContext) -> None:
await ctx.connect(auto_subscribe=AutoSubscribe.SUBSCRIBE_ALL)
if __name__ == "__main__":
cli.run_app(server)
Repro steps
lk agent dev(orlk agent start) to register the worker.- Fire two dispatches to two different, brand-new rooms within ~1 second of each other:
lk dispatch create --room concurrency-test-a --agent-name my-agent & lk dispatch create --room concurrency-test-b --agent-name my-agent & wait - The first job connects fine. ~10-20s later, the second job's connection attempt panics the whole worker process.
Actual behavior
WARNING livekit.agents - The room connection was not established within 10 seconds after calling job_entry. ... {"room": "concurrency-test-a"}
ERROR livekit - livekit_ffi::server::room:261:livekit_ffi::server::room - timed out waiting for ReadyForRoomEventRequest after ConnectCallback (room_handle=8)
FFI Panic: invalid request: timed out waiting for ReadyForRoomEventRequest after ConnectCallback (room_handle=8)
[exited with code 15]
The entire worker process exits — this also takes down the other, already-healthy job that was connected to concurrency-test-a.
Reproduced 3/3 times: twice under lk agent dev, once under lk agent start (production mode). Confirmed not specific to our own agent code, since it reproduces with the near-bare entrypoint above and no real participants/media.
Attempted workaround (partial, still broken)
We tried serializing ctx.connect() calls to avoid the race:
asyncio.Lock()at module scope — fails immediately withRuntimeError: <asyncio.locks.Lock object ...> is bound to a different event loop, because each job clearly runs in a separate OS process (confirmed viatasklist/pid), so an in-memory lock can't coordinate across them.- Cross-process file lock (
filelockpackage) — this avoids the panic, but introduces a new failure: the job holding the lock'sctx.connect()call never returns (no exception, no log line at all afterLock ... acquired), even though the participant shows asACTIVEinlk room participants list. The lock is then held forever, and every subsequent job spins forever retryingacquire()(never timing out, never erroring).
So today there's no way to run multiple concurrent jobs on one worker without either a process-killing panic or a silent permanent hang.
Why this matters
We're building an exam-proctoring agent (candidate video joins a room, agent watches for face-count/etc.) where multiple concurrent exam sessions per worker is the normal case, not an edge case. This bug currently makes that entirely unworkable — one candidate joining while another's session is active can silently take down every other active exam session on the same worker.
Happy to provide the full agent code, logs, or a minimal repo reproducing this if useful.
- Lingua principale
- Python
- Stelle
- 14.6k
- Fork
- 3.9k
- Merge medio
- 3g 3h
- PR unite (30g)
- 171
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 livekit/agents
-
Assistant markup is stripped from chat history when expressive mode is offForse già presa @ShivamSharma43 l’ha presa 7 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
docs: openai.LLM vs openai.responses.LLM for HTTP OpenAI-compat hostsForse di nuovo libera @AbarnaaSree l’ha presa 47 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
livekit/agents#7022 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
google: support Live Avatar video output for Gemini 3.8 Live (avatar_config, VIDEO modality)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
livekit/agents#7843 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 40/100
I maintainer di solito rispondono entro 1 giorno
-
StreamPacerWrapper.end_input() sets _input_ended before buffered sentences reach _sentences; last sentence(s) silently never sent to TTSForse già presa @Hugo-DDT l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di livekit/agents
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
jbacalso24/mimry#291 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 82/100
eli-alvarado/us-watchlist-alerts#14 ·
I maintainer di solito rispondono entro 1 giorno
-
from-review-extraction python severity:nit
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
LearningCircuit/local-deep-research#7462 ·
I maintainer di solito rispondono entro 2 giorni
-
mermaid_extract.py silently discards single-line state-diagram notes; sequence notes are keptAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cathrynlavery/diagram-design#441 ·
I maintainer di solito rispondono entro 2 giorni
-
[Cleanup] Include the public header in work_split.cppForse già presa @blozano-tt l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tenstorrent/tt-metal#60850 ·
I maintainer di solito rispondono entro 1 giorno