Request for review: 8011773: Some tests on Interned String crashed JVM with OOM

Coleen Phillimore coleen.phillimore at oracle.com
Wed Apr 24 08:57:23 PDT 2013


Hi, I like this change - it's moving in the direction of not aborting 
the VM for every C heap memory allocation failure we encounter if the 
Java application can do something about it (ie catch OutOfMemoryError).

A couple of problems with the code:

http://cr.openjdk.java.net/~hseigel/bug_8011773/src/share/vm/classfile/symbolTable.cpp.udiff.html 
<http://cr.openjdk.java.net/%7Ehseigel/bug_8011773/src/share/vm/classfile/symbolTable.cpp.udiff.html>

The CHECK_NULL will return NULL with the exception in the Thread object 
so, you don't have to check for chars != NULL before calling intern.   
See utilities/exceptions.hpp for what these macros do.  They are not nice.

http://cr.openjdk.java.net/~hseigel/bug_8011773/src/share/vm/oops/oop.cpp.udiff.html 
<http://cr.openjdk.java.net/%7Ehseigel/bug_8011773/src/share/vm/oops/oop.cpp.udiff.html>

The CATCH at the end will assert that an exception wasn't thrown, which 
is not what you want.  I think you want to pass THREAD, and then keep 
the null check on the next line.   For this situation, I think it's 
reasonable to call vm_exit_out_of_memory() since that is existing 
behavior and this is for rehashing the string table in a loop and 
there's a resource mark so it's difficult to run out of C heap memory 
while doing this.

Thanks,
Coleen

On 4/24/2013 11:26 AM, harold seigel wrote:
> Hi,
>
> Please review this fix for bug 8011773.
>
> Summary: Method as_unicode_string() now detects the memory allocation 
> failure and throws an OutOfMemoryError exception.  This lets its 
> callers decide whether to abort the VM or allow the exception to be 
> caught and execution continue.
>
> Open webrev at: http://cr.openjdk.java.net/~hseigel/bug_8011773/
> <http://cr.openjdk.java.net/%7Ehseigel/bug_8011773/>
> Bug Link at: http://bugs.sun.com/view_bug.do?bug_id=8011773
>
> Regression testing was done using JCK lang and vm tests, jtReg tests, 
> JPRT, and ute vm.quick.testlist tests.  Also, as_unicode_string() was 
> temporarily changed to throw OutOfMemoryError exceptions in order to 
> verify that the expected behavior occurred.
>
> Thanks, Harold



More information about the hotspot-runtime-dev mailing list