Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61387

SlaveComputer not cleaned up after the channel is closed

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • kubernetes-plugin
    • None

      Steps to reproduce:

      1. Create a Pipeline with the fellow script
        pipeline{
            
            agent {
                label "test-pod"
            }
            
            stages {
                stage("Sleep") {
                    steps {
                        sh "sleep 1000"
                    }
                }    
            }
        }
        
      1. Run the Pipeline and waiting for agent pod to start
      2. Reboot the node which the agent pod has been assigned to

      Result:

      SlaveComputer is marked as offline and never get deleted even after we delete the pod. Build will also not failed and run forever.

      Expected Result:

      SlaveComputer is deleted and the build is failed.

       

          [JENKINS-61387] SlaveComputer not cleaned up after the channel is closed

          Shenyu Zheng added a comment - - edited

          I have looked at the codes.

          After the channel is closed, SlaveComputer will call `afterDisconnect` to notify KubernetesLaunch https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/slaves/SlaveComputer.java#L625. But KubernetesLaunch didn't override this method.

          Maybe we need to implement the `afterDisconnect` method in KubernetesLaunch to clean up SlaveComputer after the channel is closed?

          Shenyu Zheng added a comment - - edited I have looked at the codes. After the channel is closed, SlaveComputer will call `afterDisconnect` to notify KubernetesLaunch https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/slaves/SlaveComputer.java#L625 . But KubernetesLaunch didn't override this method. Maybe we need to implement the `afterDisconnect` method in KubernetesLaunch to clean up SlaveComputer after the channel is closed?

          Jesse Glick added a comment -

          Hmm, this is supposed to have been addressed by a patch towards JENKINS-49707. See test case. Can you check with fine logging on org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper?

          Jesse Glick added a comment - Hmm, this is supposed to have been addressed by a patch towards JENKINS-49707 . See test case . Can you check with fine logging on org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper ?

            Unassigned Unassigned
            cizezsy Shenyu Zheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: