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

Platformlabeler can generate NULL label objects on Linux

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • platformlabeler-plugin
    • None
    • Platform: All, OS: All

      While trying to save the slave config at
      http://davidkarlsen.com/hudson/computer/hudson-slave1/configSubmit

      I get:

      Status Code: 500
      Exception:
      Stacktrace:

      java.lang.NullPointerException
      at java.util.TreeMap.put(TreeMap.java:541)
      at java.util.TreeSet.add(TreeSet.java:238)
      at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
      at java.util.TreeSet.addAll(TreeSet.java:295)
      at hudson.model.Node.getAssignedLabels(Node.java:187)
      at hudson.model.Slave.(Slave.java:152)
      at hudson.model.Slave.(Slave.java:130)
      at hudson.slaves.DumbSlave.(DumbSlave.java:53)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at
      sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:391)
      at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:344)
      at hudson.model.Descriptor.newInstance(Descriptor.java:351)
      at hudson.model.Computer.doConfigSubmit(Computer.java:927)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:185)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:101)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:54)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:74)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:492)
      at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:318)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:492)
      at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:144)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:492)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:408)
      at org.kohsuke.stapler.Stapler.service(Stapler.java:117)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
      at winstone.ServletConfiguration.execute(ServletConfiguration.java:249)
      at winstone.RequestDispatcher.forward(RequestDispatcher.java:335)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:378)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:94)
      at hudson.plugins.audit_trail.AuditTrailFilter.doFilter(AuditTrailFilter.java:64)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:97)
      at
      org.jvnet.hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:47)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:97)
      at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:86)
      at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
      at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:78)
      at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      at
      hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at
      org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:166)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at
      org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at
      org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at
      org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at
      org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:173)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at
      org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      at
      hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:66)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
      at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
      at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
      at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:244)
      at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
      at java.lang.Thread.run(Thread.java:619)

      Generated by Winstone Servlet Engine v0.9.10 at Mon Nov 23 02:27:34 CET 2009

          [JENKINS-4924] Platformlabeler can generate NULL label objects on Linux

          davidkarlsen added a comment -

          I also see this in the slavelog:

          [11/23/09 02:58:24] [SSH] Opening SSH connection to dmz1:22.

          [11/23/09 02:58:32] [SSH] Authenticating as hudson with /var/lib/hudson/.ssh/id_rsa.

          [11/23/09 02:58:35] [SSH] Authentication successful.

          [11/23/09 02:58:36] [SSH] The remote users environment is:

          BASH=/bin/sh

          BASH_ARGC=()

          BASH_ARGV=()

          BASH_EXECUTION_STRING=set

          BASH_LINENO=()

          BASH_SOURCE=()

          BASH_VERSINFO=([0]="3" [1]="2" [2]="39" [3]="1" [4]="release"
          [5]="i486-pc-linux-gnu")

          BASH_VERSION='3.2.39(1)-release'

          DIRSTACK=()

          EUID=1001

          GROUPS=()

          HOME=/home/hudson

          HOSTNAME=dmz1.davidkarlsen.com

          HOSTTYPE=i486

          IFS='

          '

          LOGNAME=hudson

          MACHTYPE=i486-pc-linux-gnu

          MAIL=/var/mail/hudson

          OPTERR=1

          OPTIND=1

          OSTYPE=linux-gnu

          PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

          POSIXLY_CORRECT=y

          PPID=1967

          PS4='+ '

          PWD=/home/hudson

          SHELL=/bin/sh

          SHELLOPTS=braceexpand:hashall:interactive-comments:posix

          SHLVL=1

          SSH_CLIENT='192.168.3.33 40783 22'

          SSH_CONNECTION='192.168.3.33 40783 192.168.3.34 22'

          TERM=dumb

          UID=1001

          USER=hudson

          _=sh

          [11/23/09 02:58:36] [SSH] Checking java version of java

          [11/23/09 02:58:40] [SSH] java -version returned 1.6.0_17.

          [11/23/09 02:58:40] [SSH] Starting sftp client.

          [11/23/09 02:58:41] [SSH] Copying latest slave.jar...

          [11/23/09 02:58:42] [SSH] Copied 211,022 bytes.

          [11/23/09 02:58:42] [SSH] Starting slave process: cd '/home/hudson' && java
          -jar slave.jar

          <===[HUDSON REMOTING CAPACITY]===>channel started

          Slave.jar version: 1.335 (private-11/20/2009 11:23-kohsuke)

          This is a Unix slave

          Copied maven-agent.jar

          Copied maven-interceptor.jar

          Copied maven2.1-interceptor.jar

          Unexpected error in launching a slave. This is probably a bug in Hudson.

          java.lang.NullPointerException

          at java.util.TreeMap.put(TreeMap.java:541)

          at java.util.TreeSet.add(TreeSet.java:238)

          at java.util.AbstractCollection.addAll(AbstractCollection.java:305)

          at java.util.TreeSet.addAll(TreeSet.java:295)

          at hudson.model.Node.getAssignedLabels(Node.java:187)

          at
          org.jvnet.hudson.plugins.platformlabeler.NodeLabelCache.refreshModel(NodeLabelCache.java:83)

          at
          org.jvnet.hudson.plugins.platformlabeler.NodeLabelCache.onOnline(NodeLabelCache.java:68)

          at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:338)

          at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:300)

          at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:193)

          at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:179)

          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

          at java.util.concurrent.FutureTask.run(FutureTask.java:138)

          at
          java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

          at java.lang.Thread.run(Thread.java:619)

          davidkarlsen added a comment - I also see this in the slavelog: [11/23/09 02:58:24] [SSH] Opening SSH connection to dmz1:22. [11/23/09 02:58:32] [SSH] Authenticating as hudson with /var/lib/hudson/.ssh/id_rsa. [11/23/09 02:58:35] [SSH] Authentication successful. [11/23/09 02:58:36] [SSH] The remote users environment is: BASH=/bin/sh BASH_ARGC=() BASH_ARGV=() BASH_EXECUTION_STRING=set BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=( [0] ="3" [1] ="2" [2] ="39" [3] ="1" [4] ="release" [5] ="i486-pc-linux-gnu") BASH_VERSION='3.2.39(1)-release' DIRSTACK=() EUID=1001 GROUPS=() HOME=/home/hudson HOSTNAME=dmz1.davidkarlsen.com HOSTTYPE=i486 IFS=' ' LOGNAME=hudson MACHTYPE=i486-pc-linux-gnu MAIL=/var/mail/hudson OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games POSIXLY_CORRECT=y PPID=1967 PS4='+ ' PWD=/home/hudson SHELL=/bin/sh SHELLOPTS=braceexpand:hashall:interactive-comments:posix SHLVL=1 SSH_CLIENT='192.168.3.33 40783 22' SSH_CONNECTION='192.168.3.33 40783 192.168.3.34 22' TERM=dumb UID=1001 USER=hudson _=sh [11/23/09 02:58:36] [SSH] Checking java version of java [11/23/09 02:58:40] [SSH] java -version returned 1.6.0_17. [11/23/09 02:58:40] [SSH] Starting sftp client. [11/23/09 02:58:41] [SSH] Copying latest slave.jar... [11/23/09 02:58:42] [SSH] Copied 211,022 bytes. [11/23/09 02:58:42] [SSH] Starting slave process: cd '/home/hudson' && java -jar slave.jar <=== [HUDSON REMOTING CAPACITY] ===>channel started Slave.jar version: 1.335 (private-11/20/2009 11:23-kohsuke) This is a Unix slave Copied maven-agent.jar Copied maven-interceptor.jar Copied maven2.1-interceptor.jar Unexpected error in launching a slave. This is probably a bug in Hudson. java.lang.NullPointerException at java.util.TreeMap.put(TreeMap.java:541) at java.util.TreeSet.add(TreeSet.java:238) at java.util.AbstractCollection.addAll(AbstractCollection.java:305) at java.util.TreeSet.addAll(TreeSet.java:295) at hudson.model.Node.getAssignedLabels(Node.java:187) at org.jvnet.hudson.plugins.platformlabeler.NodeLabelCache.refreshModel(NodeLabelCache.java:83) at org.jvnet.hudson.plugins.platformlabeler.NodeLabelCache.onOnline(NodeLabelCache.java:68) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:338) at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:300) at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:193) at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:179) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)

          Alan Harder added a comment -

          Do you use platformlabeler plugin? The exception comes from some plugin
          implementing the LabelFinder extension, and this is the only plugin I found
          using it.. it is improperly returning a null label.

          Alan Harder added a comment - Do you use platformlabeler plugin? The exception comes from some plugin implementing the LabelFinder extension, and this is the only plugin I found using it.. it is improperly returning a null label.

          Alan Harder added a comment -

          ah yes, I see platformlabeler in the stack trace above.
          you might contact the author of that plugin about providing null labels, but I'm
          updating core to avoid the exception if a null is given from any plugin.

          Alan Harder added a comment - ah yes, I see platformlabeler in the stack trace above. you might contact the author of that plugin about providing null labels, but I'm updating core to avoid the exception if a null is given from any plugin.

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/main/core/src/main/java/hudson/model/Node.java
          trunk/www/changelog.html
          http://fisheye4.cenqua.com/changelog/hudson/?cs=23975
          Log:
          [FIXED JENKINS-4924] avoid exception if a plugin implementing LabelFinder
          extension provides a null label.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/core/src/main/java/hudson/model/Node.java trunk/www/changelog.html http://fisheye4.cenqua.com/changelog/hudson/?cs=23975 Log: [FIXED JENKINS-4924] avoid exception if a plugin implementing LabelFinder extension provides a null label.

          lifeless added a comment -

          Platformlabeler component added, root cause needs fixing still.

          lifeless added a comment - Platformlabeler component added, root cause needs fixing still.

          lifeless added a comment -

          David, could you please tell me the operating system and java version of that slave?

          lifeless added a comment - David, could you please tell me the operating system and java version of that slave?

          davidkarlsen added a comment -

          Linux dmz1.davidkarlsen.com 2.6.26-2-xen-686 #1 SMP Wed Nov 4 23:23:33 UTC 2009 i686 GNU/Linux

          dmz1:/opt# java -version
          java version "1.6.0_17"
          Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
          Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

          davidkarlsen added a comment - Linux dmz1.davidkarlsen.com 2.6.26-2-xen-686 #1 SMP Wed Nov 4 23:23:33 UTC 2009 i686 GNU/Linux dmz1:/opt# java -version java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04) Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

          lifeless added a comment -

          Thanks. Two more questions:

          What distribution are you running?
          what does 'lsb_release -a' show for you?

          lifeless added a comment - Thanks. Two more questions: What distribution are you running? what does 'lsb_release -a' show for you?

          davidkarlsen added a comment -

          dmz1:~# cat /etc/debian_version
          5.0.3

          lsb-core wasn't installed, installed it now:
          dmz1:/opt# lsb_release -a
          LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch
          Distributor ID: Debian
          Description: Debian GNU/Linux 5.0.3 (lenny)
          Release: 5.0.3
          Codename: lenny

          davidkarlsen added a comment - dmz1:~# cat /etc/debian_version 5.0.3 lsb-core wasn't installed, installed it now: dmz1:/opt# lsb_release -a LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch Distributor ID: Debian Description: Debian GNU/Linux 5.0.3 (lenny) Release: 5.0.3 Codename: lenny

          lifeless added a comment -

          Ok, can you:

          • record the labels the node has
          • take the node offline and online again (to refresh the labels)
          • record the new labels values

          Theory: with lsb_release missing, we're getting null rather than falling back appropriately, may be a bug in my lsbrelease module.

          lifeless added a comment - Ok, can you: record the labels the node has take the node offline and online again (to refresh the labels) record the new labels values Theory: with lsb_release missing, we're getting null rather than falling back appropriately, may be a bug in my lsbrelease module.

          davidkarlsen added a comment -

          Seems to work fine now - thanks!

          davidkarlsen added a comment - Seems to work fine now - thanks!

          lifeless added a comment -

          Ok, cool. I would have liked to have seen the labels you were getting, but I should have enough to figure out whats going on now.

          lifeless added a comment - Ok, cool. I would have liked to have seen the labels you were getting, but I should have enough to figure out whats going on now.

          lifeless added a comment -

          Ok, confirmed, net.robertcollins.ldb.Release.Release() returns null if lsb-release isn't installed. This is fine at that layer. but the hudson plugin can't return null labels.

          lifeless added a comment - Ok, confirmed, net.robertcollins.ldb.Release.Release() returns null if lsb-release isn't installed. This is fine at that layer. but the hudson plugin can't return null labels.

          Code changed in hudson
          User: : lifeless
          Path:
          trunk/hudson/plugins/platformlabeler/src/main/java/org/jvnet/hudson/plugins/platformlabeler/PlatformDetailsTask.java
          http://fisheye4.cenqua.com/changelog/hudson/?cs=24305
          Log:
          Fix JENKINS-4924, NPE when lsb_release not installed on unix machines.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : lifeless Path: trunk/hudson/plugins/platformlabeler/src/main/java/org/jvnet/hudson/plugins/platformlabeler/PlatformDetailsTask.java http://fisheye4.cenqua.com/changelog/hudson/?cs=24305 Log: Fix JENKINS-4924 , NPE when lsb_release not installed on unix machines.

          lifeless added a comment -

          1.1 of the plugin fixes this.

          lifeless added a comment - 1.1 of the plugin fixes this.

            lifeless lifeless
            davidkarlsen davidkarlsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: