6472925: OutOfMemoryError fails to generate stack trace as it now ought
Summary: Print an additional message for OOM during stack trace printing
Reviewed-by: dholmes, phh, acorn, kamg, dcubed
--- a/hotspot/src/share/vm/runtime/thread.cpp Thu Feb 03 20:30:19 2011 -0800
+++ b/hotspot/src/share/vm/runtime/thread.cpp Mon Feb 07 14:36:26 2011 -0500
@@ -1611,7 +1611,15 @@
uncaught_exception, // Arg 2
THREAD);
}
- CLEAR_PENDING_EXCEPTION;
+ if (HAS_PENDING_EXCEPTION) {
+ ResourceMark rm(this);
+ jio_fprintf(defaultStream::error_stream(),
+ "\nException: %s thrown from the UncaughtExceptionHandler"
+ " in thread \"%s\"\n",
+ Klass::cast(pending_exception()->klass())->external_name(),
+ get_thread_name());
+ CLEAR_PENDING_EXCEPTION;
+ }
}
}