JDK-6197264 : JVMTI exception throw and catch mechanism problem b/w java and jni.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2004-11-18
  • Updated: 2023-12-13
  • Resolved: 2016-11-03
Related Reports
Relates :  
Description
When exception is cleared in jni for java thrown exception. The jvmti 
does not post exception catch event and rest all method exit and pop frame
events are thrown with exception bit set to true.
###@###.### 2004-11-18 18:01:21 GMT

Comments
This is not on our list of current priorities, if this changes please re-open this issue.
03-11-2016

EVALUATION The problem
12-01-2007

EVALUATION The _exception_detected and _exception_caught is used in jvmti thread state structure to post exception throw and catch events. There is no problem as long as exception is thrown from java code and caught inside java. The problem is when exception is thrown in java and cleared in jni code. The jni can clear exception by calling ExceptionClear(). This causes the following problem. 1. Exception catch event is not posted. 2. Exception bit is set so all method exit and pop frame event is posted with cause of exception which is not true. The second problem is fixed by clearing the exception_caught bit in jni ExceptionClear() method. This is fixed using bug id 6181784. There are different possiblity of exception throw and catch b/w java and jni. 1. Exception thrown in java and caught in jni 2. Exception thrown in java and caught in java (May go through jni). 3. Exception thrown in java and caught in jni and re-throw the same exception back and caught in java. 4. Exception thrown in java and caught in jni and throw different exception and caught in java. 5. Exception thrown in jni and caught in jni. 6. Exception thrown in jni and caught in java. 7. More complex scenario of handling of exception when backend gets the exception throw event... 8. Can you think of any other combinations? Current problems: Case 1: No Excption caught event is posted. Case 2: No problem. Case 3: No problem. But may be a problem for fixing it in ExceptionClear() Case 4: Mismatch of exception throw and catch event. Case 5: No exception throw and catch event posted. Case 6: No problem. Exception throw event get posted when it start executing java code. We need to investigate more about this problem and find out a good solution for this problem. ###@###.### 2004-11-18 18:01:21 GMT
18-11-2004