client_loop: send disconnect: Broken pipe - Is there a way for Jenkins agent to automatically restart on broken pipe, lost connection?
18:49 26 Apr 2026

I am using Jenkins agent set up on Ubuntu VM (in AWS EC2).
The Jenkins agent is started via bash script having java -jar agent.jar -url

I was planning to make it as Linux service, however it seems that it will not be fully automatic as I noticed that when WS connection was lost "Broken pipe",
the agent is not restarting connection. So the agent process is running, but connection is broken, and naturally the Jenkins node is offline status in Jenkins Controller.

How Jenkins agent can be restarted on network issue?
What if the build is running inside?

Details:

  • Jenkins Version 2.541.3
  • java -jar agent.jar -version: 3352.v17a_fb_4b_2773f
  • java 21 on both computers (Jenkins Controller and Jenkins Node)

Log is like below:

ubuntu@ip-172-31-45-210:~/jenkins$ sh start.sh
Apr 26, 2026 10:44:44 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/ubuntu/jenkins/remoting as a remoting work directory

...

INFO: Using /home/ubuntu/jenkins/remoting as a remoting work directory
Apr 26, 2026 10:44:45 PM hudson.remoting.Launcher$CuiListener status
INFO: WebSocket connection open
Apr 26, 2026 10:44:45 PM hudson.remoting.Launcher$CuiListener status
INFO: Connected
Connection to ec2.........compute.amazonaws.com closed by remote host.
Connection to ec2.........compute.amazonaws.com closed.
client_loop: send disconnect: Broken pipe
jenkins websocket service connection restart