Add a catch statement to handle the IllegalStateException being
thrown by SshConnection in very specific circumstances. If a
disconnection would occur during the short timeframe between
connecting (calling of the connect() method in GerritConnection.java)
and the moment when the ssh command is executed by the
executeCommandReader() method, the watchdog would stop trying to
reconnect to gerrit. This issue has occurred several times and
caused problems for Jenkins builds which depend on projects in Gerrit.
When caught, the exception no longer causes a reconnection issue.
The fix was tested in multiple test environments by setting a
breakpoint at the specific moment when the issue was occurring,
forcing a disconnection via failover, and observing the Watchdog's
reconnection process.
Add a catch statement to handle the IllegalStateException being thrown by SshConnection in very specific circumstances. If a disconnection would occur during the short timeframe between connecting (calling of the connect() method in GerritConnection.java) and the moment when the ssh command is executed by the executeCommandReader() method, the watchdog would stop trying to reconnect to gerrit. This issue has occurred several times and caused problems for Jenkins builds which depend on projects in Gerrit. When caught, the exception no longer causes a reconnection issue.
The fix was tested in multiple test environments by setting a breakpoint at the specific moment when the issue was occurring, forcing a disconnection via failover, and observing the Watchdog's reconnection process.