Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-8472 YARN Container Phase 2
  3. YARN-9074

Docker container rm command should be executed after stop

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.3.0
    • None
    • None

    Description

      @Override
      public void transition(ContainerImpl container, ContainerEvent event) {
      
      container.setIsReInitializing(false);
      // Set exit code to 0 on success 
      container.exitCode = 0;
      
      // TODO: Add containerWorkDir to the deletion service.
      
      if (DockerLinuxContainerRuntime.isDockerContainerRequested(
      container.daemonConf,
      container.getLaunchContext().getEnvironment())) {
      removeDockerContainer(container);
      }
      
      if (clCleanupRequired) {
      container.dispatcher.getEventHandler().handle(
      new ContainersLauncherEvent(container,
      ContainersLauncherEventType.CLEANUP_CONTAINER));
      }
      
      container.cleanup();
      }

      Now, when container is finished, NM firstly execute "docker rm xxx"  to remove it and this thread is placed in DeletionService. see more in YARN-5366 .

      Next, NM will execute "docker stop" and "docker kill" command. these tow commands are wrapped up in ContainerCleanup thread and executed by ContainersLauncher. see more in YARN-7644

      The above will cause the container's cleanup to be split into two threads. I think we should refactor these code to make all docker container killing process be place in ContainerCleanup thread and "docker rm" should be executed last.

      Attachments

        1. YARN-9074.003.patch
          10 kB
          Zhaohui Xin
        2. YARN-9074.002.patch
          10 kB
          Zhaohui Xin
        3. YARN-9074.001.patch
          6 kB
          Zhaohui Xin
        4. image-2018-12-01-11-38-18-191.png
          25 kB
          Zhaohui Xin
        5. image-2018-12-01-11-36-12-448.png
          57 kB
          Zhaohui Xin

        Issue Links

          Activity

            People

              uranus Zhaohui Xin
              uranus Zhaohui Xin
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: