You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/06/18 21:05:56 UTC
[10/16] incubator-geode git commit: GEODE-1349: prevent
'java.lang.InternalError: MemoryPool not found'
GEODE-1349: prevent 'java.lang.InternalError: MemoryPool not found'
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/bcffff9f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/bcffff9f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/bcffff9f
Branch: refs/heads/feature/GEODE-1565
Commit: bcffff9f0cc11c7e6d1055c6c72cf58383eca8b7
Parents: 374a1dc
Author: Jens Deppe <jd...@pivotal.io>
Authored: Wed May 25 13:45:00 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri Jun 17 13:19:47 2016 -0700
----------------------------------------------------------------------
.../gemfire/internal/stats50/VMStats50.java | 46 +++++++++++++++++---
1 file changed, 41 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bcffff9f/geode-core/src/main/java/com/gemstone/gemfire/internal/stats50/VMStats50.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/stats50/VMStats50.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/stats50/VMStats50.java
index 53d8f0e..6f2eea6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/stats50/VMStats50.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/stats50/VMStats50.java
@@ -16,21 +16,44 @@
*/
package com.gemstone.gemfire.internal.stats50;
-import com.gemstone.gemfire.*;
+import java.lang.management.ClassLoadingMXBean;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.StatisticDescriptor;
+import com.gemstone.gemfire.Statistics;
+import com.gemstone.gemfire.StatisticsFactory;
+import com.gemstone.gemfire.StatisticsType;
+import com.gemstone.gemfire.StatisticsTypeFactory;
+import com.gemstone.gemfire.SystemFailure;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.ClassPathLoader;
import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl;
import com.gemstone.gemfire.internal.VMStatsContract;
-
-import java.lang.management.*;
-import java.lang.reflect.Method;
-import java.util.*;
+import com.gemstone.gemfire.internal.logging.LogService;
/**
* Statistics related to a Java VM.
* This version is hardcoded to use 1.5 MXBean stats from java.lang.management.
*/
public class VMStats50 implements VMStatsContract {
+ private final static Logger logger = LogService.getLogger(VMStats50.class.getName());
+
private final static StatisticsType vmType;
private final static ClassLoadingMXBean clBean;
@@ -480,6 +503,7 @@ public class VMStats50 implements VMStatsContract {
}
private void refreshMemoryPools() {
+ boolean reInitPools = false;
Iterator<Map.Entry<MemoryPoolMXBean,Statistics>> it = mpMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<MemoryPoolMXBean,Statistics> me = it.next();
@@ -488,6 +512,7 @@ public class VMStats50 implements VMStatsContract {
if (!mp.isValid()) {
s.close();
it.remove();
+ reInitPools = true;
} else {
MemoryUsage mu = null;
try {
@@ -495,6 +520,14 @@ public class VMStats50 implements VMStatsContract {
} catch (IllegalArgumentException ex) {
// to workaround JRockit bug 36348 just ignore this and try the next pool
continue;
+ } catch (InternalError ie) {
+ // Somebody saw an InternalError once but I have no idea how to reproduce it. Was this a race between
+ // mp.isValid() and mp.getUsage()? Perhaps.
+ s.close();
+ it.remove();
+ reInitPools = true;
+ logger.warn("Accessing MemoryPool '{}' threw an Internal Error: {}", mp.getName(), ie.getMessage());
+ continue;
}
s.setLong(mp_l_initMemoryId, mu.getInit());
s.setLong(mp_l_usedMemoryId, mu.getUsed());
@@ -531,6 +564,9 @@ public class VMStats50 implements VMStatsContract {
}
}
}
+ if (reInitPools) {
+ initMemoryPools();
+ }
}
private void initGC() {