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

UsageStatistics Page Decorator may get called during initialization.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • Jenkins 1.625.2

      UsageStatistics#getStatData may get called while Jenkins is not completely initialized. As it navigates all top level items, it may cause unexpected effects in extensions and plugins affecting those items.

      Example stack trace:

              [.....]
      	at jenkins.model.Jenkins.getAllItems(Jenkins.java:1409)
      	at hudson.model.UsageStatistics.getStatData(UsageStatistics.java:160)
              [.....]
      	at org.apache.commons.jexl.util.PropertyExecutor.execute(PropertyExecutor.java:125)
      	at org.apache.commons.jexl.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:314)
              [.....]
      	at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:95)
      	at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:147)
      	at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      	at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
      	at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:150)
      	at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      	at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
      	at org.kohsuke.stapler.jelly.ReallyStaticTagLibrary$1.run(ReallyStaticTagLibrary.java:99)
              [.....]
      	at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
      	at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:95)
      	at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:63)
      	at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:53)
      	at org.kohsuke.stapler.jelly.JellyRequestDispatcher.forward(JellyRequestDispatcher.java:55)
      	at hudson.util.HudsonIsLoading.doDynamic(HudsonIsLoading.java:45)
      

          [JENKINS-32190] UsageStatistics Page Decorator may get called during initialization.

          dogfood added a comment -

          Integrated in jenkins_2.0 #5
          JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level (Revision d8a13ac07c4357eb74ab45a03955c0db430e3aa9)

          Result = SUCCESS
          arodriguez : d8a13ac07c4357eb74ab45a03955c0db430e3aa9
          Files :

          • core/src/main/java/hudson/model/UsageStatistics.java

          dogfood added a comment - Integrated in jenkins_2.0 #5 JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level (Revision d8a13ac07c4357eb74ab45a03955c0db430e3aa9) Result = SUCCESS arodriguez : d8a13ac07c4357eb74ab45a03955c0db430e3aa9 Files : core/src/main/java/hudson/model/UsageStatistics.java

          Code changed in jenkins
          User: Andres Rodriguez
          Path:
          core/src/main/java/hudson/model/UsageStatistics.java
          http://jenkins-ci.org/commit/jenkins/50b927c7fcb148ee08959d7d68b11afa40de9e15
          Log:
          JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level before generating stats.

          (cherry picked from commit d8a13ac07c4357eb74ab45a03955c0db430e3aa9)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andres Rodriguez Path: core/src/main/java/hudson/model/UsageStatistics.java http://jenkins-ci.org/commit/jenkins/50b927c7fcb148ee08959d7d68b11afa40de9e15 Log: JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level before generating stats. (cherry picked from commit d8a13ac07c4357eb74ab45a03955c0db430e3aa9)

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4450
          JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level (Revision 50b927c7fcb148ee08959d7d68b11afa40de9e15)

          Result = SUCCESS
          ogondza : 50b927c7fcb148ee08959d7d68b11afa40de9e15
          Files :

          • core/src/main/java/hudson/model/UsageStatistics.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4450 JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level (Revision 50b927c7fcb148ee08959d7d68b11afa40de9e15) Result = SUCCESS ogondza : 50b927c7fcb148ee08959d7d68b11afa40de9e15 Files : core/src/main/java/hudson/model/UsageStatistics.java

          This appears to be causing a regression. We noticed that the usage stats dropped a big time in Feb, and upon closer looking of log files, it appears that the # of usage reports started to decline around the time when this was introduced, and further more when this was backported into LTS.

          Still investigating how this might have caused a regression

          Kohsuke Kawaguchi added a comment - This appears to be causing a regression. We noticed that the usage stats dropped a big time in Feb, and upon closer looking of log files, it appears that the # of usage reports started to decline around the time when this was introduced, and further more when this was backported into LTS. Still investigating how this might have caused a regression

          One surprising discovery is that Jenkins goes through multiple cycles of initializations. Basically, each time executeReactor happens. Once from the constructor (the canonical boot sequence that I can think of), then once more from resolveDependantPlugins() (I don't know what this does — I suspect it shouldn't run a new reactor but I need to check), then every time Jenkins gets reloaded.

          Still, the end state should be always COMPLETED, so it still doesn't quite explain.

          Kohsuke Kawaguchi added a comment - One surprising discovery is that Jenkins goes through multiple cycles of initializations. Basically, each time executeReactor happens. Once from the constructor (the canonical boot sequence that I can think of), then once more from resolveDependantPlugins() (I don't know what this does — I suspect it shouldn't run a new reactor but I need to check), then every time Jenkins gets reloaded. Still, the end state should be always COMPLETED , so it still doesn't quite explain.

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          core/src/main/java/hudson/model/UsageStatistics.java
          http://jenkins-ci.org/commit/jenkins/b2013edbf7a4d40df2bc05a1e219d8599e642961
          Log:
          Revert "JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level before generating stats."

          This reverts commit d8a13ac07c4357eb74ab45a03955c0db430e3aa9.

          I noticed a strange drop in usage statistics from the mid Jan 2016,
          which corresponds to the time this change was released in the wild,
          and further drop when LTS 1.642.2 is released with this change at
          the end of Feb.

          I spent some time trying to determine how this might cause instances
          to stop sending data, but I couldn't come up with any. I left those
          notes in JENKINS-32190. There was some strange behaviours, but none
          explains what this is.

          So I'd like to back out this change and see if that makes any impact
          on the stats collection. If it backs up, then we know empirically
          this change is to blame, so that would justify spending further
          effort or come up with a fix from a different angle.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/src/main/java/hudson/model/UsageStatistics.java http://jenkins-ci.org/commit/jenkins/b2013edbf7a4d40df2bc05a1e219d8599e642961 Log: Revert " JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level before generating stats." This reverts commit d8a13ac07c4357eb74ab45a03955c0db430e3aa9. I noticed a strange drop in usage statistics from the mid Jan 2016, which corresponds to the time this change was released in the wild, and further drop when LTS 1.642.2 is released with this change at the end of Feb. I spent some time trying to determine how this might cause instances to stop sending data, but I couldn't come up with any. I left those notes in JENKINS-32190 . There was some strange behaviours, but none explains what this is. So I'd like to back out this change and see if that makes any impact on the stats collection. If it backs up, then we know empirically this change is to blame, so that would justify spending further effort or come up with a fix from a different angle.

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          core/src/main/java/hudson/model/UsageStatistics.java
          http://jenkins-ci.org/commit/jenkins/b67bb4c602192c39b28a58dba808f20ab4cb7e36
          Log:
          Merge pull request #2109 from jenkinsci/JENKINS-32190

          Revert JENKINS-32190 fix

          Compare: https://github.com/jenkinsci/jenkins/compare/f56ace54d173...b67bb4c60219

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/src/main/java/hudson/model/UsageStatistics.java http://jenkins-ci.org/commit/jenkins/b67bb4c602192c39b28a58dba808f20ab4cb7e36 Log: Merge pull request #2109 from jenkinsci/ JENKINS-32190 Revert JENKINS-32190 fix Compare: https://github.com/jenkinsci/jenkins/compare/f56ace54d173...b67bb4c60219

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4497
          Revert "JENKINS-32190 Make UsageStatistics#isDue check Jenkins init (Revision b2013edbf7a4d40df2bc05a1e219d8599e642961)

          Result = SUCCESS
          kohsuke : b2013edbf7a4d40df2bc05a1e219d8599e642961
          Files :

          • core/src/main/java/hudson/model/UsageStatistics.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4497 Revert " JENKINS-32190 Make UsageStatistics#isDue check Jenkins init (Revision b2013edbf7a4d40df2bc05a1e219d8599e642961) Result = SUCCESS kohsuke : b2013edbf7a4d40df2bc05a1e219d8599e642961 Files : core/src/main/java/hudson/model/UsageStatistics.java

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          core/src/main/java/hudson/model/UsageStatistics.java
          http://jenkins-ci.org/commit/jenkins/ce866ddb3cac225c3bf224d6b4eb89eef36f79c8
          Log:
          Revert "JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level before generating stats."

          This reverts commit d8a13ac07c4357eb74ab45a03955c0db430e3aa9.

          I noticed a strange drop in usage statistics from the mid Jan 2016,
          which corresponds to the time this change was released in the wild,
          and further drop when LTS 1.642.2 is released with this change at
          the end of Feb.

          I spent some time trying to determine how this might cause instances
          to stop sending data, but I couldn't come up with any. I left those
          notes in JENKINS-32190. There was some strange behaviours, but none
          explains what this is.

          So I'd like to back out this change and see if that makes any impact
          on the stats collection. If it backs up, then we know empirically
          this change is to blame, so that would justify spending further
          effort or come up with a fix from a different angle.

          (cherry picked from commit b2013edbf7a4d40df2bc05a1e219d8599e642961)

          Compare: https://github.com/jenkinsci/jenkins/compare/003f1e5b0c5e...ce866ddb3cac

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/src/main/java/hudson/model/UsageStatistics.java http://jenkins-ci.org/commit/jenkins/ce866ddb3cac225c3bf224d6b4eb89eef36f79c8 Log: Revert " JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level before generating stats." This reverts commit d8a13ac07c4357eb74ab45a03955c0db430e3aa9. I noticed a strange drop in usage statistics from the mid Jan 2016, which corresponds to the time this change was released in the wild, and further drop when LTS 1.642.2 is released with this change at the end of Feb. I spent some time trying to determine how this might cause instances to stop sending data, but I couldn't come up with any. I left those notes in JENKINS-32190 . There was some strange behaviours, but none explains what this is. So I'd like to back out this change and see if that makes any impact on the stats collection. If it backs up, then we know empirically this change is to blame, so that would justify spending further effort or come up with a fix from a different angle. (cherry picked from commit b2013edbf7a4d40df2bc05a1e219d8599e642961) Compare: https://github.com/jenkinsci/jenkins/compare/003f1e5b0c5e...ce866ddb3cac

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          core/src/main/java/hudson/model/UsageStatistics.java
          http://jenkins-ci.org/commit/jenkins/3a44687df5f979ea57a3206b83817c5be7299eb3
          Log:
          Revert "JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level before generating stats."

          This reverts commit d8a13ac07c4357eb74ab45a03955c0db430e3aa9.

          I noticed a strange drop in usage statistics from the mid Jan 2016,
          which corresponds to the time this change was released in the wild,
          and further drop when LTS 1.642.2 is released with this change at
          the end of Feb.

          I spent some time trying to determine how this might cause instances
          to stop sending data, but I couldn't come up with any. I left those
          notes in JENKINS-32190. There was some strange behaviours, but none
          explains what this is.

          So I'd like to back out this change and see if that makes any impact
          on the stats collection. If it backs up, then we know empirically
          this change is to blame, so that would justify spending further
          effort or come up with a fix from a different angle.

          (cherry picked from commit b2013edbf7a4d40df2bc05a1e219d8599e642961)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: core/src/main/java/hudson/model/UsageStatistics.java http://jenkins-ci.org/commit/jenkins/3a44687df5f979ea57a3206b83817c5be7299eb3 Log: Revert " JENKINS-32190 Make UsageStatistics#isDue check Jenkins init level before generating stats." This reverts commit d8a13ac07c4357eb74ab45a03955c0db430e3aa9. I noticed a strange drop in usage statistics from the mid Jan 2016, which corresponds to the time this change was released in the wild, and further drop when LTS 1.642.2 is released with this change at the end of Feb. I spent some time trying to determine how this might cause instances to stop sending data, but I couldn't come up with any. I left those notes in JENKINS-32190 . There was some strange behaviours, but none explains what this is. So I'd like to back out this change and see if that makes any impact on the stats collection. If it backs up, then we know empirically this change is to blame, so that would justify spending further effort or come up with a fix from a different angle. (cherry picked from commit b2013edbf7a4d40df2bc05a1e219d8599e642961)

            andresrc Andres Rodriguez
            andresrc Andres Rodriguez
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: