0

I had a problem on logging an OutOfMemorryError using a finally block because a new OutOfMemoryError was thrown before the log was written.

It is weird because looking only at the log it seems that the job suddenly finish in the middle of the process with no errors.

Is there any other common case that this situation can happen? Considering that my finally block is only writing the log in a file.

dinhokz
  • 895
  • 15
  • 36

1 Answers1

1

These types of errors and exceptions are called Asynchronous Exceptions. Best action would be to try to tune your JVM or your code so that this condition does occur in the first place.

You also might want to look at -XX:OnOutOfMemoryError and the -XX:+HeapDumpOnOutOfMemory command line options.

Community
  • 1
  • 1
jmehrens
  • 10,580
  • 1
  • 38
  • 47