Worker on livekit cloud shutdown automically and t...
# ask-ai
d
Worker on livekit cloud shutdown automically and then restart every 5 minutes
✅ 1
t
Thanks for reaching out, Kaushal. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m looking into the worker restarting every 5 minutes. To troubleshoot I need a few details so I can pinpoint the cause: • Which LiveKit Cloud project and worker/agent ID is affected? • When did the behavior start, and were there any recent deployments or config changes? • Do you see any logs around the shutdown/restart time (worker logs, systemd/container logs, or deployment logs)? If yes, please paste the error lines or a 30–60s window around one restart. • Do you have a custom
drain_timeout
or autoscaling policy configured? (By default drain_timeout is 1800s / 30m.) • Are there health check failures or resource limits (CPU/memory) in metrics around the restart times? What I can do next once you provide those: review logs for health-check failures or crash reasons, check deployment/drain events, and suggest concrete fixes (adjust drain_timeout, fix failing health checks, address OOMs/crashes, or debug deployments). Sources: Deployment reliability on LiveKit Cloud | LiveKit | Why is my Agent insights data missing? | LiveKit, with interactive elements
d
my agent logs {"message": "starting worker", "level": "INFO", "name": "livekit.agents", "version": "1.5.9", "rtc-version": "1.1.8", "timestamp": "2026-05-22T111726.354768+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.silero", "version": "1.5.9", "timestamp": "2026-05-22T111726.354934+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.google", "version": "1.5.9", "timestamp": "2026-05-22T111726.355017+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.openai", "version": "1.5.9", "timestamp": "2026-05-22T111726.355064+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.groq", "version": "1.5.9", "timestamp": "2026-05-22T111726.355228+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.xai", "version": "1.5.9", "timestamp": "2026-05-22T111726.355295+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.assemblyai", "version": "1.5.9", "timestamp": "2026-05-22T111726.355343+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.deepgram", "version": "1.5.9", "timestamp": "2026-05-22T111726.355388+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.cartesia", "version": "1.5.9", "timestamp": "2026-05-22T111726.355426+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.elevenlabs", "version": "1.5.9", "timestamp": "2026-05-22T111726.355468+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.minimax", "version": "1.5.9", "timestamp": "2026-05-22T111726.355503+00:00"} {"message": "plugin registered", "level": "INFO", "name": "livekit.agents", "plugin": "livekit.plugins.turn_detector.base", "version": "1.5.9", "timestamp": "2026-05-22T111726.355552+00:00"} {"message": "preloading plugins", "level": "INFO", "name": "livekit.agents", "packages": ["livekit.plugins.silero", "livekit.plugins.google", "livekit.plugins.openai", "livekit.plugins.groq", "livekit.plugins.xai", "livekit.plugins.assemblyai", "livekit.plugins.deepgram", "livekit.plugins.cartesia", "livekit.plugins.elevenlabs", "livekit.plugins.minimax", "livekit.plugins.turn_detector", "av"], "timestamp": "2026-05-22T111726.355659+00:00"} {"message": "HTTP server listening on :8082", "level": "INFO", "name": "livekit.agents", "timestamp": "2026-05-22T111726.378660+00:00"} {"message": "initializing process", "level": "INFO", "name": "livekit.agents", "pid": 232, "timestamp": "2026-05-22T111730.269690+00:00"} {"message": "initializing process", "level": "INFO", "name": "livekit.agents", "pid": 235, "timestamp": "2026-05-22T111730.294440+00:00"} {"message": "process initialized", "level": "INFO", "name": "livekit.agents", "pid": 235, "elapsed_time": 0.32, "timestamp": "2026-05-22T111730.614034+00:00"} {"message": "process initialized", "level": "INFO", "name": "livekit.agents", "pid": 232, "elapsed_time": 0.35, "timestamp": "2026-05-22T111730.617885+00:00"} {"message": "registered worker", "level": "INFO", "name": "livekit.agents", "agent_name": "osce-voice-agent", "id": "CAW_XbMgQWdUyowx", "url": "[<https://q>](https://.cloud)", "region": "Germany 2", "protocol": 17, "timestamp": "2026-05-22T111730.656927+00:00"} {"message": "draining worker", "level": "INFO", "name": "livekit.agents", "id": "CAW_XbMgQWdUyowx", "timeout": 1800, "timestamp": "2026-05-22T112219.391323+00:00"} {"message": "shutting down worker", "level": "INFO", "name": "livekit.agents", "id": "CAW_XbMgQWdUyowx", "timestamp": "2026-05-22T112219.391842+00:00"}
t
Thanks — I reviewed the logs you sent (worker starts, registers, then logs "draining worker" and "shutting down worker" ~5 minutes later). I’ll explain likely causes and next diagnostic steps. What this log shows • The agent registered successfully, then immediately entered draining with
timeout: 1800
(30m) but still began shutdown ~5 minutes later. That indicates an external trigger started the drain. Likely causes • A deployment or rollback/rolling update was triggered for that agent. • The orchestration platform (Kubernetes, container service, autoscaler) initiated a restart due to health-check failures or policy. • A wrapper/process supervisor is intercepting signals (SIGTERM) and not forwarding them, causing premature shutdown handling. • A platform-level restart policy or automated job is cycling the instance. Please provide these details so I can narrow it down • Did you perform a deployment, rollback, or
lk agent deploy
around 11:22 UTC? • Where is the agent running (LiveKit Cloud managed, Kubernetes, Docker, VM)? If Kubernetes, share the Deployment/Pod restart events or controller used. • Can you fetch the platform/container logs or events around the same timestamp (112219) — e.g., kubelet, systemd, or container runtime messages? • Is the agent behind any wrapper script or process supervisor? If so, does that script use
exec
to run the agent binary? • Can you confirm the agent health-check endpoint is reachable from the platform (default health endpoint is on the agent at port 8081)? What I can do next • If you confirm a deployment/rollback, I’ll explain the rolling update behavior and safe settings. • If it’s orchestration-related, I’ll guide you to check health-checks, restart events, and how to forward SIGTERM. • If you paste the platform/container events around the shutdown time, I’ll analyze them and recommend concrete fixes (adjust health-checks, change drain_timeout, fix wrapper scripts, or update autoscaler rules). Send the answers or the platform events/log lines and I’ll continue troubleshooting. Sources: Deployment reliability on LiveKit Cloud | LiveKit | Server options | LiveKit Documentation, with interactive elements
d
it was deployed via docker on livekit cloud, no error i could check or see i havent done any deployment or rollback
t
Thanks — that helps. Since you deployed via Docker on LiveKit Cloud and didn’t trigger a deployment, let’s focus on Docker/platform causes and quick checks. Please check and share any of the following you can: • Docker container events around 1122 run
docker events --since "2026-05-22T11:15:00" --until "2026-05-22T11:30:00"
(or equivalent) and paste relevant lines. • Container restart reason:
docker inspect --format '{{.State}}' <container-id>
output. • Agent health endpoint reachability: confirm
curl -sS http://127.0.0.1:8081/
(or the container’s 8081) from inside the host; report the HTTP status or error. • Docker restart policy or orchestrator: confirm if the container uses a restart policy (e.g.,
always
,
on-failure
) or another supervisor. Share
docker inspect <container-id>
HostConfig.RestartPolicy
. • Resource constraints: any memory/CPU limits set for the container or host that might cause OOM kills — check
dmesg
for OOM or
docker stats
around the time. • Wrapper script / PID 1: confirm the agent binary runs as PID 1 in the container (e.g.,
ps -o pid,cmd -p 1
) and that you’re not using a shell script that doesn’t
exec
the agent. Why these help • Logs/events and inspect output will show whether Docker or the host initiated a restart (OOM, health check, restart policy). • Health-check reachability can reveal orchestration-triggered restarts if the platform marks the container unhealthy. If you paste the
docker inspect
output and any container events or
dmesg
OOM lines, I’ll analyze them and recommend exact fixes (adjust health-check, change restart policy, forward SIGTERM with
exec
, increase resources, or alter drain_timeout). , with interactive elements
d
how to run these if i have deploy this in livekit cloud?
t
Thanks — good question. Because your agent is running on LiveKit Cloud you don’t run raw Docker commands there. Instead, use the LiveKit Cloud tools to gather the same info. Please try the following and paste what you see: 1. View realtime runtime logs: ◦ Run:
lk agent logs
(or
lk agent logs --id <agent-id>
) to stream logs around the shutdown. Look for the
draining worker
lines and anything just before them. 1. Check agent status and recent events: ◦ Run:
lk agent status
and
lk agent inspect --id <agent-id>
to see current state, restart counts, and deployment info. 1. View build/runtime logs in the Cloud dashboard: ◦ Open the LiveKit Cloud dashboard → Projects → Agents → select your agent → Logs tab. Switch between Build and Runtime logs and copy relevant timestamps around the restart (112219). 1. Confirm health endpoint from the agent (if possible): ◦ Enable debug logs (
LIVEKIT_LOG_LEVEL=DEBUG
) or add a quick health-check request in your agent image that calls
http://127.0.0.1:8081/
and prints the response to logs. Then redeploy and check runtime logs for the health-check result. 1. Check for automated deployments or CI: ◦ Verify no CI/CD pipeline or scheduled `lk agent deploy`/rollback is running repeatedly. What I’ll do with those outputs • If logs show a deployment/rollback trigger, I’ll explain the rolling update behavior. • If logs show health-check failures, OOMs, or crashes, I’ll recommend specific fixes (adjust health-check, increase resources, forward SIGTERM with
exec
, or change restart policy). Send the
lk agent logs
output and
lk agent inspect
results and I’ll analyze them. Sources: Deployment reliability on LiveKit Cloud | LiveKit | Where to find your Agent Logs | LiveKit | Why is my Agent insights data missing? | LiveKit, with interactive elements