JDK-6369169 : PopLocalFrame() should be safe to use when an exception is pending
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: solaris_11
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_nevada
  • CPU: generic
  • Submitted: 2006-01-05
  • Updated: 2012-10-08
  • Resolved: 2006-02-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b71Fixed
Related Reports
Relates :  
Relates :  
Description
The JNI PopLocalFrame() function isn't safe to use when an exception is pending, using it when the JVM is run with the "-verbose:jni -Xcheck:jni" flags set results in a fatal JVM error.  The JNI documentation says it is necessary to check for exceptions after every JNI call that may throw an exception, and it also strongly recommends the use of PushLocalFrame/PopLocalFrame for local reference management.  These two recommendations are pretty much in conflict because PopLocalFrame can't be called when an exception is pending.

PopLocalFrame should be made pending-exception safe, like all the other JNI functions that can be used to free local references.

Comments
EVALUATION The Xcheck:jni will not issue a warning, the spec fix will be done separately with CR: 4973054 doc consolidation effort.
31-01-2006

EVALUATION After reviewing the code it does appear that PopLocalFrame should be safe to use the Xcheck:jni logic must be changed to allow exceptions in this method. The JNI spec. need to be updated.
17-01-2006

EVALUATION Ive marked this as an RFE, since PopLocalFrame and PushLocalFrame are not Exception safe and it was never intended as per the Spec. Is it not possible to do the following in the application code ? if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionDescribe(env); // optional (*env)->ExceptionClear(env); } (*env)->PopLocalFrame(env, NULL);
10-01-2006