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

Kubernetes pod deleted before BuildWrapper cleanup

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Critical Critical
    • kubernetes-plugin
    • None
    • Jenkins 2.3, kubernetes plugin 0.6, Cloudbees Docker Build environment Plugin 1.6.5

      Hello,

      We use kubernetes plugin in conjunction with CloudBees Docker custom build environment Plugin.

      There is bad interaction between those plugins generating major resource leak. Indeed we discovered that the Kubernetes Pods are destroyed when the build completed but before build wrappers have a chance to tear down properly. This leads to resource leak on any build wrapper plugin that release its resource during tear down.
      In our specific case this mean all the docker containers launched by the custom environment plugin are never destroyed.

      We think that the problem is that KubernetesSlave relies on the OnceRetentionStrategy that terminates the slave node on the taskCompleted*() callback. This event seems to be before any hudson.tasks.BuildWrapper.Environment#tearDown(hudson.model.AbstractBuild, hudson.model.BuildListener) can be called.

      It was not clear for us how to solve this issue properly. Is there a way to extend hudson.model.listeners.RunListener and lookup/delete the pod from there ?

      Best Regards,
      David

            Unassigned Unassigned
            daijithegeek David Joaquim
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: