Introduction When Jenkins build agents go offline, queued builds cannot execute and CI/CD pipelines stall. Agent disconnections are caused by network issues, JVM problems, or Jenkins controller configuration.
Symptoms - Jenkins UI shows agent as "Offline" with red indicator - Build queued but stuck: "Waiting for next available executor" - Agent log shows: "Connection closed" or "JNLP connection lost" - Agent reconnects but disconnects again after a few minutes - All builds on the specific agent fail
Common Causes - Network interruption between controller and agent - Agent JVM crashed (OOM, OutOfMemoryError) - JNLP port not accessible through firewall - Agent JAR file corrupted - Controller load causing agent disconnects
Step-by-Step Fix 1. **Check agent status in Jenkins UI**: Manage Jenkins > Manage Nodes > Check agent status and offline reason.
- 1.Restart the agent:
- 2.```bash
- 3.# For SSH agents
- 4.ssh <agent-host> "sudo systemctl restart jenkins-agent"
- 5.# For JNLP agents, restart the agent process
- 6.java -jar agent.jar -jnlpUrl http://<jenkins>/computer/<agent>/slave-agent.jnlp
- 7.
` - 8.Check agent JVM memory settings:
- 9.```bash
- 10.# On agent host
- 11.ps aux | grep agent.jar
- 12.# Check for OOM in system logs
- 13.dmesg | grep -i oom
- 14.
`