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

hudson.model.Computer.isIdle() fails to account for fly weight tasks.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None

      The hudson.model.Computer.isIdle() method will indicate that a computer is idle even if there is a fly weight task running on it. I have a cloud plugin for a local cloud system that removes nodes after being idle for a period of time. This causes computers to get removed which are hosting fly weight tasks. Also the method hudson.model.Computer.getIdleStartMilliseconds() may need to take fly weight tasks into account.

          [JENKINS-5049] hudson.model.Computer.isIdle() fails to account for fly weight tasks.

          We'll put a fix in 1.338, but in the mean time, please set the system property -Dhudson.model.Hudson.flyweightSupport=false to disable the flyweight support.

          Kohsuke Kawaguchi added a comment - We'll put a fix in 1.338, but in the mean time, please set the system property -Dhudson.model.Hudson.flyweightSupport=false to disable the flyweight support.

          nairb774 added a comment -

          Patch to fix this issue - simple 2 line change.

          Check to see if there are any one off executors running on the computer, and if so report the computer as not idle.

          nairb774 added a comment - Patch to fix this issue - simple 2 line change. Check to see if there are any one off executors running on the computer, and if so report the computer as not idle.

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/main/core/src/main/java/hudson/model/Computer.java
          http://jenkins-ci.org/commit/26230
          Log:
          JENKINS-5049 patch from nairb774 to check for flyweight tasks in Computer.isIdle()

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/core/src/main/java/hudson/model/Computer.java http://jenkins-ci.org/commit/26230 Log: JENKINS-5049 patch from nairb774 to check for flyweight tasks in Computer.isIdle()

          Code changed in hudson
          User: : mindless
          Path:
          trunk/www/changelog.html
          http://jenkins-ci.org/commit/26231
          Log:
          note JENKINS-5049

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/www/changelog.html http://jenkins-ci.org/commit/26231 Log: note JENKINS-5049

          Alan Harder added a comment -

          shall we mark this resolved, or is something needed for getIdleStartMilliseconds() as mentioned above?

          Alan Harder added a comment - shall we mark this resolved, or is something needed for getIdleStartMilliseconds() as mentioned above?

          nairb774 added a comment -

          Patch 001-getIdleStartMilliseconds: Added logic to crawl the one off executors when compiling the idle information.

          Patch 002-countExecutors: I am less sure about this one. In one sense it should be this way, but it may have the ability to break things. For what I could tell it shouldn't but I don't know the code base as well as I would like to make the safety call on this one.

          ~Brian

          nairb774 added a comment - Patch 001-getIdleStartMilliseconds: Added logic to crawl the one off executors when compiling the idle information. Patch 002-countExecutors: I am less sure about this one. In one sense it should be this way, but it may have the ability to break things. For what I could tell it shouldn't but I don't know the code base as well as I would like to make the safety call on this one. ~Brian

          Alan Harder added a comment -

          ya, I'll leave out the last one and add javadoc to clarify. It's a minor point, but probably the usage in the remote API is implying configured executors that can do work, and may seem odd if that value fluctuates when one-off tasks are busy.
          thanks for the patches!

          Alan Harder added a comment - ya, I'll leave out the last one and add javadoc to clarify. It's a minor point, but probably the usage in the remote API is implying configured executors that can do work, and may seem odd if that value fluctuates when one-off tasks are busy. thanks for the patches!

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/main/core/src/main/java/hudson/model/Computer.java
          http://jenkins-ci.org/commit/26365
          Log:
          [FIXED JENKINS-5049] check oneOffExecutors in getIdleStartMilliseconds().
          No idle executors in this list, so this just ensures we return a future time if
          there is a busy one-off task but all other executors are idle.
          Added javadoc to clarify what countExecutors() returns.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/core/src/main/java/hudson/model/Computer.java http://jenkins-ci.org/commit/26365 Log: [FIXED JENKINS-5049] check oneOffExecutors in getIdleStartMilliseconds(). No idle executors in this list, so this just ensures we return a future time if there is a busy one-off task but all other executors are idle. Added javadoc to clarify what countExecutors() returns.

            Unassigned Unassigned
            nairb774 nairb774
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: