From bcdfb2860ffa4bef97ce01a20779b08472388231 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 7 Mar 2013 18:40:33 -0500 Subject: [PATCH] =?UTF-8?q?[FIXED=20JENKINS-15796]=20NoClassDefFoundError:?= =?UTF-8?q?=20'Could=20not=20initialize=20class=20org.jvnet.hudson.Windows?= =?UTF-8?q?$MEMORYSTATUSEX'=20from=20SwapSpaceMonitor.=20Not=20fixing=20ac?= =?UTF-8?q?tual=20linkage=20error=E2=80=94JNA=20issue=20of=20some=20kind?= =?UTF-8?q?=E2=80=94but=20ensuring=20that=20Jenkins=20reports=20it=20only?= =?UTF-8?q?=20once.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.html | 3 +++ .../node_monitors/SwapSpaceMonitor.java | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/changelog.html b/changelog.html index c852860947..b181b5ea72 100644 --- a/changelog.html +++ b/changelog.html @@ -64,6 +64,9 @@ Upcoming changes
  • Preview function for textareas using Jenkins markup did not work when CSRF protection was enabled. (issue 17085) +
  • + JNA-related error from Windows slave monitoring thrown repeatedly. + (issue 15796)
  • Improved the request handling performance (where the file lookup is expensive, such as NFS.) (issue 16606) diff --git a/core/src/main/java/hudson/node_monitors/SwapSpaceMonitor.java b/core/src/main/java/hudson/node_monitors/SwapSpaceMonitor.java index 9d7ceb0197..b2edc41fc9 100644 --- a/core/src/main/java/hudson/node_monitors/SwapSpaceMonitor.java +++ b/core/src/main/java/hudson/node_monitors/SwapSpaceMonitor.java @@ -102,17 +102,22 @@ public class SwapSpaceMonitor extends NodeMonitor { try { mm = MemoryMonitor.get(); } catch (IOException e) { - if(!warned) { - // report the problem just once, and avoid filling up the log with the same error. see HUDSON-2194. - warned = true; - throw e; - } else { - return null; - } + return report(e); + } catch (LinkageError e) { // JENKINS-15796 + return report(e); } return new MemoryUsage2(mm.monitor()); } + private MemoryUsage report(T e) throws T { + if (!warned) { + warned = true; + throw e; + } else { // JENKINS-2194 + return null; + } + } + private static final long serialVersionUID = 1L; private static boolean warned = false;