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

Jenkins startup task dependencies should be more explicit

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None
    • jenkins-2.7.3-rc

      It is a follow-up task to the investigation of JENKINS-37759. The original theory in this bug was incorrect, and lead to the pull request, which streamlines dependencies between startup tasks. Actually it is not required since Jenkins forces InitMilestone order by InitMilestone#ordering(). But it still makes sense to integrate the PR.

      Original PR: https://github.com/jenkinsci/jenkins/pull/2524

          [JENKINS-37805] Jenkins startup task dependencies should be more explicit

          Oleg Nenashev created issue -
          Oleg Nenashev made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          Oleg Nenashev made changes -
          Priority Original: Blocker [ 1 ] New: Minor [ 4 ]
          Oleg Nenashev made changes -
          Link New: This issue is related to JENKINS-37759 [ JENKINS-37759 ]
          Oleg Nenashev made changes -
          Description Original: It happens due to https://github.com/jenkinsci/jenkins/pull/2177/files, which makes COMPLETED dependent on the following logic:

          {code}
                      // All plugins are loaded. Now we can figure out who depends on who.
                       requires(PLUGINS_PREPARED).attains(COMPLETED).add("Resolving Dependant Plugins Graph", new Executable() {
                           @Override
                           public void run(Reactor reactor) throws Exception {
                               resolveDependantPlugins();
                           }
                       });
          {code}

          In this case COMPLETED state logic does not depend on the Job loading state, hence COMPLETED milestone can be achieved before JOB_LOADED in the reactor. It may easily happen when Job loading takes MUCH time. In such case COMPLETED state gets overridden by JOB_LOADED.

          Sample script for the issue analysis:
          {code}
          import hudson.init.InitMilestone;
          import hudson.util.HttpResponses;
          import javax.servlet.http.HttpServletResponse;

          final Jenkins jenkins = Jenkins.getInstance();

          if (jenkins.getInitLevel().compareTo(InitMilestone.COMPLETED) < 0) {
            println "Error: Jenkins initialization has not reached the COMPLETED state. Current state is ${jenkins.getInitLevel()}"
            return HttpResponses.status(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
          }
          {code}
          New: It is a follow-up task to the investigation of JENKINS-37759. The original theory in this bug was incorrect, and lead to the pull request, which streamlines dependencies between startup tasks. Actually it is not required since Jenkins forces InitMilestone order by InitMilestone#ordering(). But it still makes sense to integrate the PR.

          Original PR: https://github.com/jenkinsci/jenkins/pull/2524

          Oleg Nenashev made changes -
          Labels Original: lts-candidate

            Unassigned Unassigned
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: