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

Node online status cannot find node when using Pipeline job

      Jenkins Version: 1.651
      Mail Watcher Plugin: 1.13
      Pipeline: 2.0

      Steps to re-produce:

      1. Add dumb slave (my-node)
      2. Configure - Notify when node online status changes (ticked)
      3. Create pipeline job (MY_JOB), using node:

      node('my-node') {
        echo 'hello world'
      }
      

      Logs from build run:

      Apr 22, 2016 12:16:15 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
      INFO: MY_JOB #1 completed: SUCCESS
      Apr 22, 2016 12:16:15 PM org.jenkinsci.plugins.mailwatcher.NodeAwailabilityListener onFinalized
      INFO: Unable to identify the slave of MY_JOB #1 (class org.jenkinsci.plugins.workflow.job.WorkflowRun)
      java.lang.Exception
      	at org.jenkinsci.plugins.mailwatcher.NodeAwailabilityListener.onFinalized(NodeAwailabilityListener.java:79)
      	at hudson.model.listeners.RunListener.fireFinalized(RunListener.java:232)
      	at hudson.model.Run.onEndBuilding(Run.java:1888)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:540)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1100(WorkflowRun.java:111)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:777)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:843)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$4.run(CpsThreadGroup.java:340)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:32)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	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)
      

      https://github.com/jenkinsci/mail-watcher-plugin/blob/master/src/main/java/org/jenkinsci/plugins/mailwatcher/NodeAwailabilityListener.java#L78

          [JENKINS-34385] Node online status cannot find node when using Pipeline job

          Owen Wood created issue -

          This is indeed a bug. The proper fix would be to do the check once node block ends.

          Oliver Gondža added a comment - This is indeed a bug. The proper fix would be to do the check once node block ends.
          Oliver Gondža made changes -
          Component/s New: workflow-plugin [ 18820 ]

          Sorin Sbarnea added a comment -

          Any updates on this? Seems quite annoying to see so many stacktraces on the logs.

          Sorin Sbarnea added a comment - Any updates on this? Seems quite annoying to see so many stacktraces on the logs.
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 170490 ] New: JNJira + In-Review [ 183921 ]
          Jakub Cechacek made changes -
          Assignee Original: Oliver Gondža [ olivergondza ] New: Jakub Cechacek [ jcechace ]

          Github PR sent.

          The "solution" is not very elegant, however I think the best we can do is getting rid of that exception in cases when mail-watcher plugin encountered unsupported build type.

          Jakub Cechacek added a comment - Github PR sent. The "solution" is not very elegant, however I think the best we can do is getting rid of that exception in cases when mail-watcher plugin encountered unsupported build type.

          jcechace, just noting that suggested improvement hide the annoying message but doe not address the real problem: this plugin does not support pipeline.

          Oliver Gondža added a comment - jcechace , just noting that suggested improvement hide the annoying message but doe not address the real problem: this plugin does not support pipeline.

          Jakub Cechacek added a comment - - edited

          After discussion with olivergondza I propose the following as optimal way for plugin to be notified about workflow when `node` block was entered or left.

          • Make ExecutorListener extend ExtensionPoint
          • Modify WorkUnitContext to properly notify all registered extensions of type ExecutorListener
          • Implement new WatcherExecutorListener which would notify user when owner node is temporarily offline and all executors become idle.
          • Deprecate NodeAwailabilityListener in favour of WatcherExecutorListener

          The downside is that modifications in core are required and thus the issue will be resolved only with new releases.

          @jglick Could you share your opinion regarding this approach? Thanks.

          Jakub Cechacek added a comment - - edited After discussion with olivergondza I propose the following as optimal way for plugin to be notified about workflow when `node` block was entered or left. Make ExecutorListener extend ExtensionPoint Modify WorkUnitContext to properly notify all registered extensions of type ExecutorListener Implement new WatcherExecutorListener which would notify user when owner node is temporarily offline and all executors become idle. Deprecate NodeAwailabilityListener in favour of WatcherExecutorListener The downside is that modifications in core are required and thus the issue will be resolved only with new releases. @ jglick Could you share your opinion regarding this approach? Thanks.
          Jesse Glick made changes -
          Labels New: workflow

            jcechace Jakub Cechacek
            owood Owen Wood
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: