agents icon indicating copy to clipboard operation
agents copied to clipboard

Jump in `process is unresponsive, killing process` errors

Open NikoLandgraf opened this issue 1 year ago • 47 comments

When we upgraded from version 1.2.7 -> 1.2.12, we started seeing process is unresponsive, killing process errors. The upgrade happened without any code changes to our agent. We have never seen this error before.

Sometimes (impossible to reproduce unfortunately), in around 1% of our calls we are seeing the process is unresponsive, killing process error, which crashes the application.

In the process of investigating, we have triple-checked our code for potential synchronous blocking code. We could not find any problem. We had to downgrade to 1.2.7 now to mitigate this problem.

What I see in the logs is always the same (when this error happens):

  1. Google warning no candidates in the response
  2. llm node finished
  3. Agent starts speaking
  4. TTS Node yielding all audio frames (so this node finishes as well)
  5. Agent audio cracks (probably in the exact same moment the TTS Node finishes to process the last audio frame)
  6. Dead silence without possibility to interrupt - dead lock
  7. after exactly 59 / 60s (this is the ping pong timeout) AFTER the tts node has finished processing the audio we get the process is unresponsive, killing process error

Usually the next log should be agent stopped speaking / on_conversation_item_added, but we never see this log. We do not execute any code after the TTS Node.

Screening through some livekit commits in the versions 1.2.8 - 1.2.12 I found this potentially connected commit: https://github.com/livekit/agents/pull/3438/commits

I would suspect that the last audio frame causes an issue, leading to that block.

Image

Even weirder is (see screenshot attached/above) that sometimes the exact same job_id is used to create a new job request. That leads to a "fresh start" right in between the conversation, which causes other problems.

NikoLandgraf avatar Oct 13 '25 15:10 NikoLandgraf

run a SonarQube scan, just to be safe

TheAli711 avatar Oct 14 '25 08:10 TheAli711

We've been having a similar issue. In our case, there can be several talk turns in a row where the agent is getting a response from the user and makes successful stt_node, tts_node and llm_node calls, but the agent's audio never makes it to the LiveKit room and the user hear nothing but silence. The process isn't killed until shortly after the use disconnects from the room.

We're seeing this issue in both 1.2.14 and 1.2.5. We're using GPT-4 as the LLM, Deepgram as the STT, and ElevenLabs as TTS with a Cartesia fallback.

We append to transcript files in both an on_conversation_item_added handler and transcription_node handler and upload the files to the cloud in an on_shutdown callback. Is it possible that the blocking function calls in those handlers could cause an issue if file or network I/O is occasionally slower than usual?

archfear avatar Oct 15 '25 18:10 archfear

We are facing facing exactly same issue

Lanznx avatar Oct 16 '25 14:10 Lanznx

We think we're experiencing this as well.

martin-purplefish avatar Oct 16 '25 22:10 martin-purplefish

I'm getting same issue (process is unresponsive, killing process) with livekit-agents==1.2.7

CC: @theomonnom @davidzhao @longcw

mehadi92 avatar Oct 20 '25 17:10 mehadi92

+1 seeing this without any other helpful log

L65FREAD avatar Oct 20 '25 18:10 L65FREAD

same here

lhylton avatar Oct 20 '25 21:10 lhylton

We are also seeing the same issue.

muntasir2000 avatar Oct 21 '25 13:10 muntasir2000

process is unresponsive, killing process occurs because the worker process hits a ping timeout (hardcoded to 60 seconds).

In my case, the issue happened because the model loading took too long, and I resolved it with the following approach.

1. Check your WorkerOptions.num_idle_processes setting

When running in dev mode, it defaults to 0, and in prod mode, it defaults to min(math.ceil(get_cpu_monitor().cpu_count()), 4).

If you’ve set this value to 2 or higher, try lowering it to 1 — this helps reduce the model initialization overhead time.

2. Use WorkerOptions.prewarm_fnc to preload your model

You can preload the model during the worker initialization phase like this:

def prewarm(proc: JobProcess) -> None:
    ...
    tts = TTS()
    # I used a Hugging Face TTS model; load_model() internally calls from_pretrained()
    # tts.load_model()
     proc.userdata["tts"] = tts

if __name__ == "__main__":
    cli.run_app(
        worker_options(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm, num_idle_processes=1)
    )

yoonsula avatar Oct 22 '25 09:10 yoonsula

In our case, we get this issue in the middle of a voice conversation

mehadi92 avatar Oct 23 '25 03:10 mehadi92

https://livekit-users.slack.com/archives/C07FY8WHGPM/p1761196912132379?thread_ts=1759829844.079439&cid=C07FY8WHGPM

I have reported the issue above where we run into this case. Others please also include as much detail as possible.

zaheerabbas-prodigal avatar Oct 23 '25 05:10 zaheerabbas-prodigal

https://livekit-users.slack.com/archives/C07FY8WHGPM/p1761196912132379?thread_ts=1759829844.079439&cid=C07FY8WHGPM

I have reported the issue above where we run into this case. Others please also include as much detail as possible.

Is that Slack for LiveKit customers? If so, how can I get access to the workspace?

archfear avatar Oct 23 '25 17:10 archfear

@archfear - yes it is a community slack workspace you can join livekit slack. Workspace url - https://livekit-users.slack.com/

zaheerabbas-prodigal avatar Oct 23 '25 17:10 zaheerabbas-prodigal

@zaheerabbas-prodigal It looks like you need an @livekit.io email address to join.

Image

archfear avatar Oct 23 '25 17:10 archfear

sign up using google

zaheerabbas-prodigal avatar Oct 23 '25 18:10 zaheerabbas-prodigal

@zaheerabbas-prodigal I tried, which is how I got that "The email address must match one of the domains listed below." error in the screenshot.

archfear avatar Oct 23 '25 18:10 archfear

@archfear - try going through the slack logo link on their documentation page - https://docs.livekit.io/home/ ?

Image

zaheerabbas-prodigal avatar Oct 23 '25 18:10 zaheerabbas-prodigal

@zaheerabbas-prodigal Thanks! That did the trick. I missed that button.

archfear avatar Oct 23 '25 19:10 archfear

Hey, this can happen when the event_loop is blocked/stuck. Do you guys have any steps to reproduce this issue? Also make sure to never do any heavy CPU operation on the main thread, as well as using blocking IO

theomonnom avatar Oct 24 '25 20:10 theomonnom

I'll update my event handler functions that are using blocking IO to be async and see if that does the trick. It's been impossible to consistently reproduce this issue.

@theomonnom Did something change recently the would cause unresponsive processes to be killed more frequently? I've only seen it once since rolling back to 1.2.5.

archfear avatar Oct 24 '25 20:10 archfear