Rolling Out a JDK Upgrade to 2,000+ Jenkins Agents

My client's CI runs on more than 2,000 bare-metal Jenkins build agents, driven by over a dozen controllers across several data centers. At that size, how you roll out a change matters as much as the change. This is the story of a JDK upgrade that reached most of the fleet in half an hour and broke it, how Claude Code helped me recover it, and how the client rolls out changes now.
How big the CI fleet is
Every commit in the company's pipelines lands somewhere on this fleet, so a fleet-wide problem stops thousands of teams at once. The diagram shows the moving parts: jobs flow across the top, and configuration flows up from Puppet underneath.
A pipeline service queues work and routes it to a Jenkins controller, which the team calls a shard. Each controller drives a few hundred agents with several executors each, so the fleet runs thousands of builds at the same time. The controller starts an agent process, a Java virtual machine (JVM), on each agent over SSH, and that JVM stays up for days.
How the client rolls out changes
Agents are grouped into machine groups by environment and data center. Each group is pinned to one Puppet git commit, and pinning a new commit makes every agent in the group apply it on its next run. Groups climb a ladder: development, integration, staging, canary, then production.
That model is fast. A production change reaches every agent in about half an hour, which is great for security patches and terrible for mistakes. It also only moves forward: the client's Puppet pipeline refuses to move a host back to an older commit, so rollback wasn't an option. Undoing a change means rolling out yet another commit to the whole fleet.
What broke: a JDK upgrade and a deleted helper
The security patch moved every agent to a newer JDK package. Puppet installed it and removed the old package, which deleted the old JDK directory. The running agent JVMs did not crash: Linux keeps a deleted program's code mapped in memory, so they kept accepting work.
Trouble starts when a build step runs a command. On Linux, Java starts child processes through a helper binary called jspawnhelper in its own lib directory. That file went away with the old JDK, so every new process failed, and the error named the program being launched instead:
java.io.IOException: Cannot run program "/bin/bash" (in directory "workspace/app-build"):
error=2, No such file or directory
error=2 is the kernel's "file not found" code, but /bin/bash was fine. The missing file was jspawnhelper, so teams lost time checking bash and workspaces. A step already running usually finished, so jobs died at their next step and the failure looked random. Staging never showed it, because its agents happened to reconnect after the upgrade and picked up the new JDK.
How Claude found the root cause
I gave Claude Code three things: the thread where users reported failures, the Puppet commit I had rolled out, and permission to SSH into agents for read-only checks. It matched the first failures to the rollout window, then logged into one failing agent:
# When did the JDK package change? It matched the first failures.
rpm -qi jdk-21 | grep 'Install Date'
# Which binary is the agent JVM really running?
sudo readlink /proc/$(pgrep -f '[a]gent\.jar')/exe
/usr/lib/jvm/jdk-21-old/bin/java (deleted)
# Is the spawn helper still on disk?
ls /usr/lib/jvm/jdk-21-old/lib/jspawnhelper
ls: cannot access '/usr/lib/jvm/jdk-21-old/lib/jspawnhelper': No such file or directory
/proc/<pid>/exe links to the binary a process started from, and the kernel adds (deleted) once that file is gone: an exact, cheap signal. The [a] stops pgrep matching its own command line. Package names and paths vary by distribution, so treat these as a template.
I checked each claim on the host before acting. Claude also took one wrong turn: it reached for metrics dashboards to find affected hosts. I steered it to a plain parallel-SSH sweep, because the host is the ground truth and metrics can lag.
Healing 2,000+ agents with a read-only sweep
With rollback off the table, the fix was to restart every agent JVM running a deleted JDK, and nothing else. A controller relaunches a killed agent within about a minute, onto the JDK installed now. The flowchart shows the split: I approved each phase, Claude did the legwork.
The sweep runs one read-only command on every agent with pssh (parallel SSH), keeping each host's output in its own file:
# Print each agent JVM's pid and the binary it runs, on every host
pssh -h agents.txt -p 100 -t 20 -o out/ \
'for p in $(pgrep -f "[a]gent\.jar"); do echo "$p $(sudo readlink /proc/$p/exe)"; done'
# Hosts whose agent JVM runs a deleted JDK
grep -l '(deleted)' out/* | xargs -n1 basename > restart.txt
-p 100 works on 100 hosts at a time, -t 20 gives up on a host after 20 seconds, and -o out/ writes one file per host. pssh prints [FAILURE] for hosts it cannot reach, and Claude listed those separately instead of guessing. After I reviewed the list, the restart touched only those hosts:
# Kill only the affected agent JVMs; each controller relaunches its agent on the new JDK
pssh -h restart.txt -p 100 -t 20 'sudo pkill -f "[a]gent\.jar"'
This is safe in an emergency because the broken agents were failing every new step anyway. Without the bracket trick, pkill -f can kill the remote shell running it. A second sweep found no (deleted) JVMs, and every affected agent recovered. The sweep and restart took minutes; most of the three hours went on diagnosis.
How the client rolls out changes now
A JDK upgrade is not finished until every running JVM uses the new JDK, and a fleet this size should never take a change all at once. The before-and-after view shows the new rollout, following the follow-ups from the post-mortem:
- Staged rollouts: one canary shard, watched for an hour, then all canary groups, watched for four hours, then production.
- Group-level drain: the team's operator console takes a whole machine group offline, waits for running jobs, applies the new commit and brings the group back.
- A drain-aware guard: each agent restarts its own JVM after a JDK change, only while idle.
- Detection: an alert on agent JVMs running deleted binaries.
Common pitfalls
| Pitfall | What to do instead |
|---|---|
| Trusting "Cannot run program /bin/bash" | Check /proc/<pid>/exe for (deleted) |
| Restarting every agent | Restart only JVMs on a deleted JDK |
pkill -f killing its own shell | Use a bracketed pattern such as [a]gent\.jar |
| Letting the AI use an indirect signal | Point it at ground truth on the host |
| Granting write access up front | Read-only first, then approve each write |
For the assistant side, see the read-only design in an AI co-pilot for the first 10 minutes, and use the toil audit to pick what to automate next.
Key takeaways
- At fleet scale, the rollout process is the safety net: stage changes and watch each stage.
- A package upgrade under a long-running JVM needs a restart plan.
(deleted)in/proc/<pid>/exeexactly marks a process that predates an upgrade.- An AI agent shines at correlation and fleet-wide toil, while humans keep every approval.
Related articles

Kubernetes Auto-Remediation: Self-Healing with Guardrails
Wire Alertmanager to a remediation worker that grows full PVCs, rolls back stuck rollouts and evicts leaky pods, guarded by a kill switch, blast-radius and rate limits, and a circuit breaker. Then measure auto-closed alerts and MTTR.

LLM Root Cause Analysis: Correlate Logs, Metrics, Traces
Most incidents follow a change. Give an LLM the deploy history, one PromQL result, filtered logs and a trace, and it returns ranked root-cause hypotheses with evidence for and against, plus the guardrails that keep it honest.

ML Anomaly Detection for Metrics: Beyond Static Thresholds
Static thresholds page at lunch and sleep at 4 a.m. Learn to score Prometheus metrics with an isolation forest in Python and gate pages on SLO burn rate, cutting pager noise without missing real incidents.