I do the build process by means of SBT, with a lot of parallelism. Sometimes, SBT dies and by looking at its console output it doesn't tell the cause.
I have made an exit hook in the JVM, and it is called. So, I discard the JVM is crashing.
How can I diagnose the cause?.
Maybe someone is calling System.exit()
, or the memory is exhausted.
If I repeat the build, then it succeeds. It is a quite deterministic process, except for the mentioned problem I'm experiencing.
It fails about 5 or 10% of times.
UPDATE 1:
One idea is to use the -XX:onError option of the JVM.
I already have this code (in Scala language) when booting the JVM, in order to diagnose who is killing the JVM:
System setSecurityManager new SecurityManager() {
override def checkPermission(perm: Permission) = {}
override def checkPermission(perm: Permission, context: scala.Any) = {}
override def checkExit(status: Int) = {
super.checkExit(status)
println("Trying to exit from: ")
Thread.currentThread.getStackTrace.foreach { p ⇒
println(p.toString)
}
}
}
but no output is shown.
I'm using Linux (CentOS 7)