-
Bug
-
Resolution: Fixed
-
Major
-
Windows 7 64bit
jdk1.7.0_07
-
Powered by SuggestiMate
Hi,
We are periodically getting issues with the hudson.util.jna.Kernel32 class not being found when plugins are calling the isSymlink method.
[xUnit] [INFO] - [UnitTest-1.4 (default)] - 1 test report file(s) were found with the pattern 'tests.xml' relative to 'C:\Jenkins\jobs\NetworkTeam Test\workspace' for the testing framework 'UnitTest-1.4 (default)'. FATAL: Could not initialize class hudson.util.jna.Kernel32 java.lang.NoClassDefFoundError: Could not initialize class hudson.util.jna.Kernel32 at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:62) at hudson.Util.isSymlink(Util.java:322) at hudson.Util.deleteRecursive(Util.java:283) at hudson.FilePath$11.invoke(FilePath.java:982) at hudson.FilePath$11.invoke(FilePath.java:980) at hudson.FilePath.act(FilePath.java:851) at hudson.FilePath.act(FilePath.java:824) at hudson.FilePath.deleteRecursive(FilePath.java:980) at org.jenkinsci.plugins.xunit.XUnitPublisher.processDeletion(XUnitPublisher.java:374) at org.jenkinsci.plugins.xunit.XUnitPublisher.performXUnit(XUnitPublisher.java:124) at org.jenkinsci.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:93) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:807) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:782) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:729) at hudson.model.Run.execute(Run.java:1541) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236)
The class file seems to be present and correct compared with the github versions and we are running with Admin access to the filesystem.
Any help would be appreciated.
Rob
- is duplicated by
-
JENKINS-15579 Could not initialize class hudson.util.jna.Kernel32 when cleaning workspace
-
- Resolved
-
-
JENKINS-16115 Publisher hudson.plugins.mstest.MSTestPublisher aborted due to exception hudson.util.IOException2: remote file operation failed
-
- Resolved
-
- is related to
-
JENKINS-15974 FATAL: Failed to link the library: interface hudson.util.jna.Kernel32
-
- Resolved
-
[JENKINS-15466] Fatal Error No Class Definition found for Kernel32
Integrated in jenkins_main_trunk #1987
JENKINS-15466 remember the cause of the initialization failure given that JVM doesn't remember. (Revision 7e8bf72eac30952c33d8dabb653bf87cd25ff991)
Result = UNSTABLE
kohsuke : 7e8bf72eac30952c33d8dabb653bf87cd25ff991
Files :
- core/src/main/java/hudson/util/jna/InitializationErrorInvocationHandler.java
- core/src/main/java/hudson/util/jna/Kernel32Utils.java
I got similar exception while wiping out remote workspace on Jenkins 1.486:
Status Code: 500 Exception: remote file operation failed: D:\AppData\Jenkins\workspace\tac at hudson.remoting.Channel@5683bdec:Analysis 1 Stacktrace: hudson.util.IOException2: remote file operation failed: D:\AppData\Jenkins\workspace\tac at hudson.remoting.Channel@5683bdec:Analysis 1 at hudson.FilePath.act(FilePath.java:847) at hudson.FilePath.act(FilePath.java:824) at hudson.FilePath.deleteRecursive(FilePath.java:980) at hudson.model.AbstractProject.doDoWipeOutWorkspace(AbstractProject.java:1901) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:151) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:90) at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:111) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:574) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:488) at org.kohsuke.stapler.Stapler.service(Stapler.java:162) 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:95) at hudson.plugins.audit_trail.AuditTrailFilter.doFilter(AuditTrailFilter.java:66) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:98) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87) at winstone.FilterConfiguration.execute(FilterConfiguration.java:194) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47) 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 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 jenkins.security.ApiTokenFilter.doFilter(ApiTokenFilter.java:63) 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:194) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50) 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:215) at winstone.RequestHandlerThread.run(RequestHandlerThread.java:138) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: Remote call on Analysis 1 failed at hudson.remoting.Channel.call(Channel.java:673) at hudson.FilePath.act(FilePath.java:840) ... 75 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class hudson.util.jna.Kernel32 at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:62) at hudson.Util.isSymlink(Util.java:322) at hudson.Util.deleteRecursive(Util.java:283) at hudson.FilePath$11.invoke(FilePath.java:982) at hudson.FilePath$11.invoke(FilePath.java:980) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2308) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1$1.run(Engine.java:60) ... 1 more Generated by Stapler at Fri Oct 19 09:13:10 CST 2012
I'm getting this same issue when cleaning the workspace. Please release a fix asap!
I've reported the clean workspace issue here https://issues.jenkins-ci.org/browse/JENKINS-15579
We are getting the same issue periodically on Win2008R2 64bit, jdk1.7.0_06, Jenkins 1.478.
By the way the “remember the cause of the initialization failure…” diagnostic patch is in 1.487, so if a Java 6 user of this build (or newer) can still reproduce, please attach your log file here for analysis.
When cleaning the workspace of a project using Jenkins ver. 1.492-SNAPSHOT on Java 6 (jdk1.6.0_22) I get the following error:
Nov 29, 2012 11:05:18 AM org.apache.catalina.core.ApplicationContext log SEVERE: Error while serving http://mycisserver/net/jenkins/view/N2/job/myclient/doWipeOutWorkspace java.lang.reflect.InvocationTargetException 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:288) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:151) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:90) at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:111) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:573) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:658) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:573) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:658) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:241) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:573) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:658) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:487) at org.kohsuke.stapler.Stapler.service(Stapler.java:164) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95) at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:58) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:98) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.UnsupportedOperationException: Failed to link the library: interface hudson.util.jna.Kernel32 at hudson.util.jna.InitializationErrorInvocationHandler.invoke(InitializationErrorInvocationHandler.java:28) at $Proxy101.GetFileAttributesW(Unknown Source) at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:76) at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:80) at hudson.Util.isSymlink(Util.java:322) at hudson.Util.deleteRecursive(Util.java:283) at hudson.FilePath$11.invoke(FilePath.java:983) at hudson.FilePath$11.invoke(FilePath.java:981) at hudson.FilePath.act(FilePath.java:852) at hudson.FilePath.act(FilePath.java:825) at hudson.FilePath.deleteRecursive(FilePath.java:981) at hudson.model.AbstractProject.doDoWipeOutWorkspace(AbstractProject.java:1921) ... 55 more Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'kernel32': com.sun.jna.Native.open(Ljava/lang/String;)J at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:166) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:239) at com.sun.jna.Library$Handler.<init>(Library.java:140) at com.sun.jna.Native.loadLibrary(Native.java:366) at com.sun.jna.Native.loadLibrary(Native.java:351) at hudson.util.jna.Kernel32Utils.load(Kernel32Utils.java:85) at hudson.util.jna.Kernel32.<clinit>(Kernel32.java:37) at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:76) at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:80) at hudson.Util.isSymlink(Util.java:322) at hudson.Util.deleteRecursive(Util.java:283) at hudson.ClassicPluginStrategy.explode(ClassicPluginStrategy.java:403) at hudson.ClassicPluginStrategy.createPluginWrapper(ClassicPluginStrategy.java:117) at hudson.PluginManager$1$3$1.run(PluginManager.java:223) at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146) at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259) at jenkins.model.Jenkins$7.runTask(Jenkins.java:883) at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187) at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) ... 1 more
Jenkins 1.491
Slave_1 with jdk1.6.0_35:
11:16:25 Build step 'Execute Windows batch command' marked build as failure
11:16:26
11:16:38 Deleting project workspace... done
Slave_2 with jdk1.6.0_37
11:16:14 Build step 'Execute Windows batch command' marked build as failure 11:16:15 11:16:15 Deleting project workspace... ERROR: Publisher hudson.plugins.ws_cleanup.WsCleanup aborted due to exception 11:16:15 hudson.util.IOException2: remote file operation failed: e:\build_e\slave_2\workspace\image\ebaa21bd at hudson.remoting.Channel@6db17b38:slave_2 11:16:15 at hudson.FilePath.act(FilePath.java:848) 11:16:15 at hudson.FilePath.act(FilePath.java:825) 11:16:15 at hudson.FilePath.deleteRecursive(FilePath.java:981) 11:16:15 at hudson.plugins.ws_cleanup.WsCleanup.perform(WsCleanup.java:68) 11:16:15 at hudson.tasks.BuildStepMonitor$2.perform(BuildStepMonitor.java:27) 11:16:15 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804) 11:16:15 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:779) 11:16:15 at hudson.model.Build$BuildExecution.cleanUp(Build.java:192) 11:16:15 at hudson.model.Run.execute(Run.java:1560) 11:16:15 at hudson.matrix.MatrixRun.run(MatrixRun.java:146) 11:16:15 at hudson.model.ResourceController.execute(ResourceController.java:88) 11:16:15 at hudson.model.Executor.run(Executor.java:236) 11:16:15 Caused by: java.io.IOException: Remote call on slave_2 failed 11:16:15 at hudson.remoting.Channel.call(Channel.java:674) 11:16:15 at hudson.FilePath.act(FilePath.java:841) 11:16:15 ... 11 more 11:16:15 Caused by: java.lang.NoClassDefFoundError: Could not initialize class hudson.util.jna.Kernel32 11:16:15 at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:76) 11:16:15 at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:80) 11:16:15 at hudson.Util.isSymlink(Util.java:322) 11:16:15 at hudson.Util.deleteRecursive(Util.java:283) 11:16:15 at hudson.FilePath$11.invoke(FilePath.java:983) 11:16:15 at hudson.FilePath$11.invoke(FilePath.java:981) 11:16:15 at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2309) 11:16:15 at hudson.remoting.UserRequest.perform(UserRequest.java:118) 11:16:15 at hudson.remoting.UserRequest.perform(UserRequest.java:48) 11:16:15 at hudson.remoting.Request$2.run(Request.java:287) 11:16:15 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) 11:16:15 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) 11:16:15 at java.util.concurrent.FutureTask.run(FutureTask.java:138) 11:16:15 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 11:16:15 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 11:16:15 at hudson.remoting.Engine$1$1.run(Engine.java:60) 11:16:15 at java.lang.Thread.run(Thread.java:662) 11:16:15 Finished: FAILURE
Slaves do have also other differences. Builds where matrix run siblings.
I suspect that this is (yet another) case of Windows being a bit non-deterministic - we had this bug happening @work and rebooting the slave made the problem go away, but the slaves get rebooted regularly anyway...
As a workaround, I'd suggest that the code drop back to the "old fashioned" way of comparing the canonical path to absolute path if the Windows-specific code fails.
This is what I'm doing at work now - as this is an intermittant issue it is difficult to be certain that this change had fixed it completely, but I am sure that it's no worse.
I've attached a patch that does this workaround.
@pjdarton: best to submit a pull request—gets more visibility, more easily reviewed. Anyway your patch would not apply against current trunk, needs a bit of an update.
The patch I uploaded was written against 1.480.1 (the LTS branch /stable), not against the bleeding edge code, hence I wouldn't be surprised if it doesn't apply directly.
One would hope that this sort of bug would be fixed in the LTS build as well (as that's what I'm running, and I found this JIRA by googling against the error I was seeing!).
The patch itself is dead trivial and probably easier for someone with commit-rights to hand-craft the code instead of doing a patch - just surround the call to Kernel32Utils in a try/catch, catch NoClassDefFoundError and ignore it, allowing execution to continue on to the general case.
i.e. replace
return Kernel32Utils.isJunctionOrSymlink(file);
with
try { return Kernel32Utils.isJunctionOrSymlink(file); } catch (NoClassDefFoundError ex) { /* * Kernel32 does not load reliably. * If it fails, fall through to the manual method. */ }
Can someone encountering this bug on 1.487+ (i.e. with 7e8bf72) please confirm that the original error (including the UnsatisfiedLinkError message) is printed somewhere in the Jenkins log file, under the Failed to load Kernel32 heading? If so, silently catching NoClassDefFoundError as @pjdarton proposes should suffice; otherwise some additional logging work needs to be done.
Note: I've just encountered (and logged) JENKINS-16070, which also relates to this isJunctionOrSymlink(...) method.
I'm now of the opinion that no call to jna can be trusted, hence any feature that uses native calls either needs to go to extreme lengths to ensure that it has excellent error trapping (and deadlock prevention), or needs a facility to disable its use.
I would therefore suggest that this windows-specific isJunctionOrSymlink behavior be made configurable - from my point of view, the trouble it's causing outweighs the benefits (the Jenkins code all looks fine, it's just the code it calls that's not reliable).
This error is still occurring in 1.497.
The Disk Usage plugin consistently fails where the workspace cleanup step intermittently fails.
Both are caused by (from the console output):
Caused by: java.lang.NoClassDefFoundError: Could not initialize class hudson.util.jna.Kernel32
at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:76)
at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:80)
at hudson.Util.isSymlink(Util.java:322)
The Jenkins slave error log also displays:
Dec 3, 2012 6:54:03 AM hudson.util.jna.Kernel32Utils load
SEVERE: Failed to load Kernel32
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at hudson.util.jna.Kernel32Utils.load(Kernel32Utils.java:85)
at hudson.util.jna.Kernel32.<clinit>(Kernel32.java:37)
at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:76)
at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:80)
at hudson.Util.isSymlink(Util.java:322)
We've started to receive this error after updating to jdk-7u9-windows-x64. The problem is that the nunit constantly fails on when trying to clean. We are currently running a patched version of 1.480.1
Recording NUnit tests results
[16:57:17] - ERROR: Publisher hudson.plugins.nunit.NUnitPublisher aborted due to exception
[16:57:17] - hudson.util.IOException2: remote file operation failed: *****\temporary-junit-reports at hudson.remoting.Channel@271d097d:WSAB101036
[16:57:17] - at hudson.FilePath.act(FilePath.java:838)
[16:57:17] - at hudson.FilePath.act(FilePath.java:824)
[16:57:17] - at hudson.FilePath.deleteRecursive(FilePath.java:908)
[16:57:17] - at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:115)
[16:57:17] - at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
[16:57:17] - at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:717)
[16:57:17] - at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:692)
[16:57:17] - at hudson.model.Build$BuildExecution.post2(Build.java:183)
[16:57:17] - at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:639)
[16:57:17] - at hudson.model.Run.execute(Run.java:1527)
[16:57:17] - at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
[16:57:17] - at hudson.model.ResourceController.execute(ResourceController.java:88)
[16:57:17] - at hudson.model.Executor.run(Executor.java:236)
[16:57:17] - Caused by: java.io.IOException: Remote call on ***** failed
[16:57:17] - at hudson.remoting.Channel.call(Channel.java:673)
[16:57:17] - at hudson.FilePath.act(FilePath.java:831)
[16:57:17] - ... 12 more
[16:57:17] - Caused by: java.lang.NoClassDefFoundError: Could not initialize class hudson.util.jna.Kernel32
[16:57:17] - at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:62)
[16:57:17] - at hudson.Util.isSymlink(Util.java:314)
[16:57:17] - at hudson.Util.deleteRecursive(Util.java:279)
[16:57:17] - at hudson.FilePath$11.invoke(FilePath.java:910)
[16:57:17] - at hudson.FilePath$11.invoke(FilePath.java:908)
[16:57:17] - at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2236)
[16:57:17] - at hudson.remoting.UserRequest.perform(UserRequest.java:118)
[16:57:17] - at hudson.remoting.UserRequest.perform(UserRequest.java:48)
[16:57:17] - at hudson.remoting.Request$2.run(Request.java:326)
[16:57:17] - at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
[16:57:17] - at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
[16:57:17] - at java.util.concurrent.FutureTask.run(Unknown Source)
[16:57:17] - at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[16:57:17] - at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[16:57:17] - at hudson.remoting.Engine$1$1.run(Engine.java:60)
[16:57:17] - at java.lang.Thread.run(Unknown Source)
@hanabi 1.483 introduces direct support for Java 7, bypassing JNA for these calls.
I was having a similar issue on windows, and here's what helped me:
In case the problem is triggered by JNA's UnsatisfiedLinkError on a library, say, "kernel.32.dll" I suggest checking that the jnidispatch.dll that is being linked is the one from JNA, not from any other location in Path.
Debugging java.exe with a simple test case that loads the problematic library using JNA's Native.loadLibrary (say, kernel32.dll) in Visual Studio (I suggest checking all the exceptions) will show you which library was actually used.
That helped me, and I hope will help with this issue too.
In case it doesn't I would recommend checking jnidispatch.dll from JNA's jar (choose the appropriate .dll for you 32-bit or 64-bit platform) and check that there are no errors or missing libraries.
Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
core/src/main/java/hudson/util/jna/InitializationErrorInvocationHandler.java
core/src/main/java/hudson/util/jna/Kernel32Utils.java
http://jenkins-ci.org/commit/jenkins/70273dddfb7875d567d73b1b3eeb30614aceac4f
Log:
JENKINS-15466 remember the cause of the initialization failure given that JVM doesn't remember.
(cherry picked from commit 7e8bf72eac30952c33d8dabb653bf87cd25ff991)
We are having this issue on Jenkins 1.480 after installing the m2release plugin v0.9.1, on a Windows slave when running new jobs. Sample output below. Disabling the plugin resolves the issue, but we would like to use the plugin.
Cloning the remote Git repository Cloning repository origin hudson.util.IOException2: remote file operation failed: z:\jenkins\workspace\com.jagex.libs.native thirdparty at hudson.remoting.Channel@7ae5fdad:win-build-slave-1 at hudson.FilePath.act(FilePath.java:838) at hudson.FilePath.act(FilePath.java:824) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1063) at hudson.model.AbstractProject.checkout(AbstractProject.java:1256) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494) at hudson.model.Run.execute(Run.java:1502) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236) Caused by: java.io.IOException: Remote call on win-build-slave-1 failed at hudson.remoting.Channel.call(Channel.java:673) at hudson.FilePath.act(FilePath.java:831) ... 10 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class hudson.util.jna.Kernel32 at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:62) at hudson.Util.isSymlink(Util.java:314) at hudson.Util.deleteRecursive(Util.java:279) at hudson.FilePath$11.invoke(FilePath.java:910) at hudson.FilePath$11.invoke(FilePath.java:908) at hudson.FilePath.act(FilePath.java:842) at hudson.FilePath.act(FilePath.java:824) at hudson.FilePath.deleteRecursive(FilePath.java:908) at hudson.plugins.git.GitAPI.clone(GitAPI.java:211) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1121) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1063) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2200) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1$1.run(Engine.java:60) at java.lang.Thread.run(Unknown Source) Finished: FAILURE
We are seeing this issue still in 1.500 while trying to wipe out a CVS workspace on a Windows slave.
Granted I am using an old CVS plugin version (1.6) to use an external CVS client, but the problem appears to be elsewhere. The trace looks like Jack's from above except called from CVSSCM.checkout instead of Git(I would paste it in, but I closed it while trying to fix the issue).
Disconnecting the Windows slave and having the service automatically reconnect resolved the issue.
I thought I saw a similar ticket marked as resolved. Perhaps this got fixed for the master but not for slaves?
I am also seeing this error on 1.500 as well.
I am using the Subversion plugin and the issue is intermittent.
Here is an excerpt of the error logs from the windows slave:
11/02/2013 3:39:39 PM hudson.util.jna.Kernel32Utils load
SEVERE: Failed to load Kernel32
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at hudson.util.jna.Kernel32Utils.load(Kernel32Utils.java:85)
at hudson.util.jna.Kernel32.<clinit>(Kernel32.java:37)
at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:76)
at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:80)
at hudson.Util.isSymlink(Util.java:322)
at hudson.Util.deleteRecursive(Util.java:283)
at hudson.Util.deleteContentsRecursive(Util.java:204)
at hudson.scm.subversion.CheckoutUpdater$1.perform(CheckoutUpdater.java:75)
at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:153)
at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:903)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:884)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:867)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2348)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
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 hudson.remoting.Engine$1$1.run(Engine.java:60)
at java.lang.Thread.run(Thread.java:662)
Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
core/src/main/java/hudson/util/jna/Kernel32Utils.java
http://jenkins-ci.org/commit/jenkins/b5ed31990e4f37d574761fd49d0ee48f3123dc88
Log:
JENKINS-15466
Failure to load JNA should be handled graciously
–
You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
@dogfood - I use 1.480.1 LTS and after upgrading to this version from 1.447.2 some of my nodes starting have the issues but others do not. I have the issue with SVN updates when they do the deleting of files as part of the cleanup. So is the issue related to the plugin or is it part of the core Jenkins? As for the fix above, when will that be integrated into the LTS versions because this is killing us. The only good work around I have found so far is to remove the workspace files for the problem build and then build again. The removal is a manual process. Setting SVN to do a fresh checkout does not seem to work either.
Anyone else have options? If we reverted, what version should we downgrade to?
Thanks
This issue isn't related to the plugin - it hits more than just the SVN plugin - it's related to the core Jenkins code that the plugins use: Basically, it's very difficult to do basic filesystem operations with any reliability on Windows.
I suspect that upgrading to the latest Jenkins and running that on a Java7 JVM may neatly sidestep this issue, but I've not tried that myself (I just added a try/catch around the problem code and ran a version of Jenkins that I'd compiled myself, as I also wanted to include code that retried delete ops under Windows which haven't made it into the main code yet).
I have the same issue raised during the workspace cleaning.
Jenkins 1.480.3
Slave: Win2003, java 6_22 and 7_15 (both tested)
The workaround I have found that seems to work so far is to set the SVN checkout option "Use 'svn update' as much as possible". That way it doesn't try to do a delete, just does an update. This work around is ok for some jobs, but others really need to use the "Emulate a clean checkout" option to ensure everything is clean. So I guess I am reiterating that this is still a big issue and is there anyway to get a fix into the latest LTS version?
it looks like the error is occured when Jenkins attempts to delete file on Windows machine.
Since this is fixed on the trunk, will/can this be marked as resolved soon so that it can be released into 1.504?
And what is also very important when it could be released in LTS?
Code changed in jenkins
User: Jesse Glick
Path:
changelog.html
core/src/main/java/hudson/Util.java
core/src/main/java/hudson/util/jna/Kernel32Utils.java
http://jenkins-ci.org/commit/jenkins/010866ba90fb7af074c5c447c1bd5143f60c00e2
Log:
[FIXED JENKINS-15466] More robust handling of Windows JNA errors.
b5ed319 already caught linkage errors but then unconditionally returned false from Util.isSymlink, which is wrong;
we want to fall back to the generic File.canonicalPath comparisons in this case.
–
You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Integrated in jenkins_main_trunk #2308
[FIXED JENKINS-15466] More robust handling of Windows JNA errors. (Revision 010866ba90fb7af074c5c447c1bd5143f60c00e2)
Result = SUCCESS
Jesse Glick : 010866ba90fb7af074c5c447c1bd5143f60c00e2
Files :
- core/src/main/java/hudson/Util.java
- changelog.html
- core/src/main/java/hudson/util/jna/Kernel32Utils.java
I am facing this issue on version 2.73.2. Please find the log file below.
Nov 02, 2017 3:41:48 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Remote identity confirmed: fe:69:3c:a5:b3:d4:da:b1:4d:b4:d9:1b:0d:9a:1b:b4
Nov 02, 2017 3:41:48 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by hudson.remoting.RemoteClassLoader (file:/C:/Users/jenkins/Desktop/slave.jar) to method java.lang.ClassLoader.getClassLoadingLock(java.lang.String)
WARNING: Please consider reporting this to the maintainers of hudson.remoting.RemoteClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Nov 02, 2017 3:41:55 PM hudson.util.jna.Kernel32Utils load
SEVERE: Failed to load Kernel32
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at hudson.util.jna.Kernel32Utils.load(Kernel32Utils.java:112)
at hudson.util.jna.Kernel32.<clinit>(Kernel32.java:37)
at hudson.util.jna.Kernel32Utils.getWin32FileAttributes(Kernel32Utils.java:77)
at hudson.util.jna.Kernel32Utils.isJunctionOrSymlink(Kernel32Utils.java:98)
at hudson.Util.isSymlink(Util.java:513)
at hudson.FilePath.deleteRecursive(FilePath.java:1201)
at hudson.FilePath.deleteContentsRecursive(FilePath.java:1220)
at hudson.FilePath.access$1100(FilePath.java:197)
at hudson.FilePath$15.invoke(FilePath.java:1194)
at hudson.FilePath$15.invoke(FilePath.java:1191)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2750)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1$1.run(Engine.java:94)
at java.base/java.lang.Thread.run(Unknown Source)
Code changed in jenkins
User: Kohsuke Kawaguchi
Path:
core/src/main/java/hudson/util/jna/InitializationErrorInvocationHandler.java
core/src/main/java/hudson/util/jna/Kernel32Utils.java
http://jenkins-ci.org/commit/jenkins/7e8bf72eac30952c33d8dabb653bf87cd25ff991
Log:
JENKINS-15466remember the cause of the initialization failure given that JVM doesn't remember.