2021-06-22 16:09:45.264+0000 [id=497] INFO o.j.p.workflow.job.WorkflowRun#finish: hello-world-gce #9 completed: SUCCESS
2021-06-22 16:09:45.936+0000 [id=497] INFO hudson.remoting.Request$2#run: Failed to send back a reply to the request hudson.remoting.Request$2@67760e47: hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel@c9422c06:obs11-ubuntu-18-linux-14sl9x": channel is already closed
Therefore, the CloudProvisioningListener#onFailure is executed even though the build did finish successfully.
As far as I see the Google Compute Engine uses the OnceRetentionStrategy when the task has finished and therefore the taskCompleted is executed for the AbstractCloudSlave.
IIUC, the piece of stacktrace is caused by https://github.com/jenkinsci/jenkins/blob/862acf3e2d3fd48330a7326bd8901d82085244d6/core/src/main/java/hudson/slaves/NodeProvisioner.java#L235-L241
Question, what's the best approach to gracefully terminate the connection in the cloud providers?
My aim, is to extend the CloudProvisioningListener class to monitor what cloud workers failed genuinely versus the ones that were killed gracefully?
Thanks
INFO hudson.remoting.Request$2#run: Failed to send back a reply to the request hudson.remoting.Request$2@…: hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel@…": channel is already closed