Skip to content

Commit

Permalink
0001869: The symmetric wrapper kills the process when an OOM error oc…
Browse files Browse the repository at this point in the history
…curs before the heap can be dumped
  • Loading branch information
erilong committed Aug 12, 2014
1 parent 63e1ca3 commit d16b8c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -207,8 +207,8 @@ private Map<String, ArrayList<String>> getProperties(String filename) throws IOE
if (!line.matches("^\\s*#.*") && !line.matches("\\s*")) {
int index = line.indexOf("=");
if (index != -1) {
String name = line.substring(0, index);
String value = line.substring(index + 1);
String name = line.substring(0, index).trim();
String value = line.substring(index + 1).trim();
if (name.matches(".*\\d{1,2}")) {
name = name.substring(0, name.lastIndexOf("."));
}
Expand Down
Expand Up @@ -120,6 +120,7 @@ protected void execJava(boolean isConsole) {

ArrayList<String> cmd = config.getCommand(isConsole);
String cmdString = commandToString(cmd);
boolean usingHeapDump = cmdString.indexOf("-XX:+HeapDumpOnOutOfMemoryError") != -1;
logger.log(Level.INFO, "Working directory is " + System.getProperty("user.dir"));

long startTime = 0;
Expand Down Expand Up @@ -166,7 +167,9 @@ protected void execJava(boolean isConsole) {
} else {
logger.log(Level.INFO, line, "java");
}
if (line.matches(".*java.lang.OutOfMemoryError.*") || line.matches(".*java.net.BindException.*")) {
if ((usingHeapDump && line.matches("Heap dump file created.*")) ||
(!usingHeapDump && line.matches("java.lang.OutOfMemoryError.*")) ||
line.matches(".*java.net.BindException.*")) {
logger.log(Level.SEVERE, "Stopping server because its output matches a failure condition");
child.destroy();
childReader.close();
Expand Down

0 comments on commit d16b8c7

Please sign in to comment.