Issue
After updating my controller, I am observing intermittent connection issues, specially when using ssh agents. We can see errors such as:
java.lang.IllegalStateException: Channel id=2 not registered because session is being closed
Or
org.apache.sshd.common.SshException: Received SSH_MSG_CHANNEL_REQUEST on unknown channel 0
Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
-
CloudBees CI (CloudBees Core) on traditional platforms - Client controller
-
CloudBees Jenkins Enterprise - Managed controller
Resolution
You might want to verify if you have installed and are using CloudBees SSH Build Agents plugin 2.5, if that’s the case, then you might be affected by CTR-1444, this is an internal defect tracker. The defect was fixed in version 2.6 of the plugin as mentioned in the plugin’s Release Notes for version 2.6
CloudBees SSH Build Agents plugin intermittent SSH error since version 2.5 (CTR-1444)
The ChannelExec close without parameters was closing the underlying ssh channel connection synchronously in the CloudBees SSH Build Agents plugin since version 2.5, making the connection unstable.
With this fix, ChannelExec is now closed asynchronously using close(false) instead of the closeable close method.
Upgrading the plugin is the right way to fix this issue. Depending on the version that you are running, the plugin version might not be available to be installed if you have BeeKeeper enabled. If that’s the case, we recommend you to follow the steps described in the document shown below to get access to this version: