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

safeRestart (and restart) via url causes exception (missing libjnidispatch.so) on RaspberryPi (ARM)

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

      When attempting to restart Jenkins via the url:
      <myserver>/restart
      or
      <myserver>/safeRestart

      I get the error message below.
      I suspect the cause/fix might be related to something specific about the JRE on the RaspberryPi, due to this bit of the trace:

      Caused by: java.lang.UnsatisfiedLinkError: jnidispatch (/com/sun/jna/linux-arm/libjnidispatch.so) not found in resource path

      Stack trace

      javax.servlet.ServletException: hudson.lifecycle.RestartNotSupportedException: Failed to obtain the command line arguments of the process
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:778)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:631)
      at org.kohsuke.stapler.Stapler.service(Stapler.java:225)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
      at winstone.ServletConfiguration.execute(ServletConfiguration.java:248)
      at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:96)
      at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:88)
      at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
      at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
      at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
      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 jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
      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:174)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at jenkins.security.ApiTokenFilter.doFilter(ApiTokenFilter.java:79)
      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:67)
      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:194)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
      at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:46)
      at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
      at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
      at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
      at winstone.RequestDispatcher.forward(RequestDispatcher.java:331)
      at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:227)
      at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:724)
      Caused by: hudson.lifecycle.RestartNotSupportedException: Failed to obtain the command line arguments of the process
      at hudson.lifecycle.UnixLifecycle.verifyRestartable(UnixLifecycle.java:98)
      at jenkins.model.Jenkins.safeRestart(Jenkins.java:3248)
      at jenkins.model.Jenkins.doSafeRestart(Jenkins.java:3207)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:120)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
      ... 51 more
      Caused by: java.lang.UnsatisfiedLinkError: jnidispatch (/com/sun/jna/linux-arm/libjnidispatch.so) not found in resource path
      at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:697)
      at com.sun.jna.Native.loadNativeLibrary(Native.java:674)
      at com.sun.jna.Native.<clinit>(Native.java:115)
      at com.sun.akuma.CLibrary.<clinit>(CLibrary.java:89)
      at com.sun.akuma.JavaVMArguments.resolvePID(JavaVMArguments.java:126)
      at com.sun.akuma.JavaVMArguments.ofLinux(JavaVMArguments.java:114)
      at com.sun.akuma.JavaVMArguments.of(JavaVMArguments.java:104)
      at com.sun.akuma.JavaVMArguments.current(JavaVMArguments.java:92)
      at hudson.lifecycle.UnixLifecycle.<init>(UnixLifecycle.java:54)
      at hudson.lifecycle.Lifecycle.get(Lifecycle.java:93)
      at jenkins.model.Jenkins.safeRestart(Jenkins.java:3247)
      ... 62 more

          [JENKINS-22425] safeRestart (and restart) via url causes exception (missing libjnidispatch.so) on RaspberryPi (ARM)

          Dan Rollo added a comment -

          Aha. Thanks Dominik for correcting the "Component" flag (I didn't see the "core" option).

          Dan Rollo added a comment - Aha. Thanks Dominik for correcting the "Component" flag (I didn't see the "core" option).

          Michka Popoff added a comment -

          I have the same problem on my Cubietruck, with an ARM processor, on Fedora 20.
          I can even not start jenkins with the "service jenkins start" command line.

          I installed java-1.7.0-openjdk and jna 3.5.2-2.fc20

          I found the libjnidispatch.so in /usr/lib/jna. So it seems it's not looking at the right place.

          Michka Popoff added a comment - I have the same problem on my Cubietruck, with an ARM processor, on Fedora 20. I can even not start jenkins with the "service jenkins start" command line. I installed java-1.7.0-openjdk and jna 3.5.2-2.fc20 I found the libjnidispatch.so in /usr/lib/jna. So it seems it's not looking at the right place.

          Dan Rollo added a comment - - edited

          FWIW, I found the following discussion that appears to indicate this native lib is missing from the version of jna included in jenkins:
          http://stackoverflow.com/questions/14635999/jna-native-support-com-sun-jna-linux-arm-libjnidispatch-so-not-found-in-resou

          I checked on my Pi, and found the following jna jars:
          /var/cache/jenkins/war/WEB-INF/lib/jna-3.3.0-jenkins-3.jar
          /var/lib/jenkins/plugins/pam-auth/WEB-INF/lib/jna-3.4.0.jar

          I verified the v3.3.0 jna jar does not include a linux-arm lib.
          I also verified the v3.4.0 jna jar does include a linux-arm lib: (found here: com/sun/jna/linux-arm/libjnidispatch.so)

          It seems a workaround might be to install libjnidispatch.so manually (not sure how to do that).
          And a fix for Jenkins might be to upgrade the version of jna used (say to 3.4.0+) (not sure how best to do that either).

          ...more info:
          I tried copying the jna v3.4.0 jar in place of the 3.3.0 version (and removed the v3.3.0 version), restarted Jenkins, and still get the same error. I then checked the 3.4.0 version contents and found it does include linux-arm/libjnidispatch.so, but for some reason, it is not working.

          Next, replaced v3.3.0 with v4.1.0 (the latest release). => Joy! I can now invoke safeRestart via the web browser without errors.

          I guess I'll try submitting a pull request to update the jna version used by Jenkins to v4.1.0. Forking now...

          Dan Rollo added a comment - - edited FWIW, I found the following discussion that appears to indicate this native lib is missing from the version of jna included in jenkins: http://stackoverflow.com/questions/14635999/jna-native-support-com-sun-jna-linux-arm-libjnidispatch-so-not-found-in-resou I checked on my Pi, and found the following jna jars: /var/cache/jenkins/war/WEB-INF/lib/jna-3.3.0-jenkins-3.jar /var/lib/jenkins/plugins/pam-auth/WEB-INF/lib/jna-3.4.0.jar I verified the v3.3.0 jna jar does not include a linux-arm lib. I also verified the v3.4.0 jna jar does include a linux-arm lib: (found here: com/sun/jna/linux-arm/libjnidispatch.so) It seems a workaround might be to install libjnidispatch.so manually (not sure how to do that). And a fix for Jenkins might be to upgrade the version of jna used (say to 3.4.0+) (not sure how best to do that either). ...more info: I tried copying the jna v3.4.0 jar in place of the 3.3.0 version (and removed the v3.3.0 version), restarted Jenkins, and still get the same error. I then checked the 3.4.0 version contents and found it does include linux-arm/libjnidispatch.so, but for some reason, it is not working. Next, replaced v3.3.0 with v4.1.0 (the latest release). => Joy! I can now invoke safeRestart via the web browser without errors. I guess I'll try submitting a pull request to update the jna version used by Jenkins to v4.1.0. Forking now...

          Michka Popoff added a comment -

          I made some investigations.
          The problem was already raised 5 years ago : https://issues.jenkins-ci.org/browse/JENKINS-3603
          Kohsuke Kawaguchi asked the people from JNA to add com/sun/jna/linux-arm/libjnidispatch.so

          This seems to have been done in:
          https://github.com/twall/jna/commit/6041c067a5449e3a3370a94bd89659ff2594a6ff
          So this was merged in jna 3.4.0.

          So why is this file missing when installing jna 3.5.2-2.fc20 ? Because it is still present in the code:
          https://github.com/twall/jna/blob/9340b94e63386f37d3ff10a92146806ef101504e/build.xml#L399

          Michka Popoff added a comment - I made some investigations. The problem was already raised 5 years ago : https://issues.jenkins-ci.org/browse/JENKINS-3603 Kohsuke Kawaguchi asked the people from JNA to add com/sun/jna/linux-arm/libjnidispatch.so This seems to have been done in: https://github.com/twall/jna/commit/6041c067a5449e3a3370a94bd89659ff2594a6ff So this was merged in jna 3.4.0. So why is this file missing when installing jna 3.5.2-2.fc20 ? Because it is still present in the code: https://github.com/twall/jna/blob/9340b94e63386f37d3ff10a92146806ef101504e/build.xml#L399

          Dan Rollo added a comment -

          Dunno why the native lib in 3.4.0 does not work, but I tried it and it didn't. I suspect there is a problem with the lib in that JNA version.

          Dropping the 4.1.0 jar into a working Jenkins does work.
          However, there are some minor API changes needed to get the Jenkins JNA code to build from source using JNA 4.1.0 -> basically the classes need to add a method: getFieldOrder() (which became required around v3.5.0). See here for details: http://twall.github.io/jna/3.5.0/javadoc/com/sun/jna/Structure.html

          I've started looking into make the required changes on the Jenkins source, but feel free to beat me to it (not sure how much time I'm gonna have in the near future).

          Dan Rollo

          Dan Rollo added a comment - Dunno why the native lib in 3.4.0 does not work, but I tried it and it didn't. I suspect there is a problem with the lib in that JNA version. Dropping the 4.1.0 jar into a working Jenkins does work. However, there are some minor API changes needed to get the Jenkins JNA code to build from source using JNA 4.1.0 -> basically the classes need to add a method: getFieldOrder() (which became required around v3.5.0). See here for details: http://twall.github.io/jna/3.5.0/javadoc/com/sun/jna/Structure.html I've started looking into make the required changes on the Jenkins source, but feel free to beat me to it (not sure how much time I'm gonna have in the near future). Dan Rollo

          Michka Popoff added a comment -

          I'll give it a try in the next weeks but it may take me some time to get it done. Never wrote Java before

          Michka Popoff added a comment - I'll give it a try in the next weeks but it may take me some time to get it done. Never wrote Java before

          Dan Rollo added a comment -

          I have created a pull request with the new version of jna and the required getFieldOrder() methods added to Structure sub classes.

          https://github.com/jenkinsci/jenkins/pull/1181

          One remaining problem is cloudbees:maven-license-plugin complains about an unexpected license for the updated jna lib (was empty, now has valid license). Suggestions of a fix for this are welcome.

          Dan Rollo added a comment - I have created a pull request with the new version of jna and the required getFieldOrder() methods added to Structure sub classes. https://github.com/jenkinsci/jenkins/pull/1181 One remaining problem is cloudbees:maven-license-plugin complains about an unexpected license for the updated jna lib (was empty, now has valid license). Suggestions of a fix for this are welcome.

          Jenkins has been updated to use JNA 4.1: JENKINS-24521
          Please try again, since this fixes many native library issues.

          Craig Rodrigues added a comment - Jenkins has been updated to use JNA 4.1: JENKINS-24521 Please try again, since this fixes many native library issues.

          Michka Popoff added a comment -

          I can confirm that this fixes it for me.

          Michka Popoff added a comment - I can confirm that this fixes it for me.

            bhamail Dan Rollo
            bhamail Dan Rollo
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: