There is a jenkins job that runs for more than an hour which deploys code on the target server. In this job it is getting stuck after 20 minutes and after 2 hours it is giving error as :

packet_write_wait: Broken pipe.

On the target server the value of /etc/ssh/sshd_config file values are set to : ClientAliveInterval 300 ClientAliveCountMax 720 MaxSessions 50

Not getting the root cause of the issue or how should i troubleshoot it.

  • Welcome to the community! Please note always keep practice to add Error, Details and objectives, What all you have tried etc to get quick and correct help for your query Jan 16, 2023 at 13:00

1 Answer 1


Helping hand :

  • Broken pipe generally means there was a network disconnect for some reason

  • The fix found so far is mobile-shell

  • You will need to install mosh-server in your target (the server you want to ssh'ed to) and mosh-client in your host machine.

  • Another solution is to turn on TCPKeepAlive options under /etc/ssh/ssh_config in client ssh:

TCPKeepAlive yes

  • After applying above solution everything worked as expected and not observed broken pipe again :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.