Merge pull request #5564 from dwijnand/1.4/oome-null-msg

Avoid making NPEs out of OOMEs!
This commit is contained in:
eugene yokota 2020-05-19 20:19:00 -04:00 committed by GitHub
commit 1f3ac6c8cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -151,7 +151,8 @@ object MainLoop {
case Left(t) => state.handleError(t)
}
} catch {
case oom: OutOfMemoryError if oom.getMessage.contains("Metaspace") =>
case oom: OutOfMemoryError
if oom.getMessage != null && oom.getMessage.contains("Metaspace") =>
System.gc() // Since we're under memory pressure, see if more can be freed with a manual gc.
val isTestOrRun = state.remainingCommands.headOption.exists { exec =>
val cmd = exec.commandLine