<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ec2 on Adam Vu</title><link>https://vutg.me/tags/ec2/</link><description>Recent content in Ec2 on Adam Vu</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 06 Feb 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://vutg.me/tags/ec2/index.xml" rel="self" type="application/rss+xml"/><item><title>Fix Jenkins EC2 Agent Disconnecting Mid-Build</title><link>https://vutg.me/posts/fix-jenkins-ec2-agent-disconnecting-mid-build/</link><pubDate>Tue, 06 Feb 2024 00:00:00 +0000</pubDate><guid>https://vutg.me/posts/fix-jenkins-ec2-agent-disconnecting-mid-build/</guid><description>&lt;p&gt;I recently ran into a frustrating issue where Jenkins EC2 build agents were randomly disconnecting mid-build. What made it tricky to diagnose was that all memory and CPU metrics looked completely normal — no resource pressure, no obvious signs of stress on the agents.&lt;/p&gt;
&lt;p&gt;Jenkins EC2 build agents were randomly going offline mid-build with the following errors:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;AgentOfflineException: Unable to create live FilePath for EC2 (ci-cicd-agents) - build-ui-build (i-04ea4c67e83f0fea5);
EC2 (ci-cicd-agents) - build-ui-build (i-04ea4c67e83f0fea5) was marked offline: Connection was broken
...
ERROR: Issue with creating launcher for agent EC2 (ci-cicd-agents) - build-ui-build (i-04ea4c67e83f0fea5).
The agent has not been fully initialized yet
...
java.io.StreamCorruptedException: invalid stream header: 636F7272
 	at java.base/java.io.ObjectInputStream.readStreamHeader(Unknown Source)
 	at java.base/java.io.ObjectInputStream.&amp;lt;init&amp;gt;(Unknown Source)
 	at hudson.remoting.ObjectInputStreamEx.&amp;lt;init&amp;gt;(ObjectInputStreamEx.java:50)
 	at hudson.remoting.Command.readFrom(Command.java:141)
 	at hudson.remoting.Command.readFrom(Command.java:127)
 	at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
 	at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:62)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The controller logs showed the agent channel dying shortly after the build started:&lt;/p&gt;</description></item></channel></rss>