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

Hot loaded plugin which extend HealthCheckProvider will fail to work property

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • metrics-plugin
    • None

      If you hot load a plugin from the update center and this plugin has an extension point to HealthCheckProvider, the provided won't be loaded correctly and it will print this exception on the log:

      May 22, 2017 10:42:28 AM jenkins.metrics.api.Metrics$HealthChecker$3 run
      SEVERE: Error running jenkins.metrics.api.Metrics$HealthChecker
      java.lang.UnsupportedOperationException
      	at java.util.Collections$UnmodifiableCollection.add(Collections.java:1055)
      	at jenkins.metrics.api.Metrics$HealthChecker.execute(Metrics.java:604)
      	at jenkins.metrics.api.Metrics$HealthChecker.access$700(Metrics.java:408)
      	at jenkins.metrics.api.Metrics$HealthChecker$3.run(Metrics.java:554)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

      This is because in case the provider is not registered, the metrics plugin will try to register it by modifiying an unmodifiableSortedSet:

      https://github.com/jenkinsci/metrics-plugin/blob/d94a4547b11263c094b2f713b37f7f0610882878/src/main/java/jenkins/metrics/api/Metrics.java#L604

      https://github.com/iZettle/dropwizard-metrics/blob/v3.1.2/metrics-healthchecks/src/main/java/com/codahale/metrics/health/HealthCheckRegistry.java#L51

            dnusbaum Devin Nusbaum
            alobato Alvaro Lobato
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: