I agree Pavel - it should be fixed in the launcher. But, as I said in [1], we should
give some consideration to the fact that the RI and IBM vms exit gracefully
under the same circumstances, and that perhaps we should also try to
fix this in the drlvm to match their behaviour.

I started to think of ways simply calling ExceptionClear wouldnt result
in a clean exit from drlvm. An OutOfMemoryError followed by DestroyJavaVM
would probably still result in a failure in VMStart, so just calling
ExceptionClear might not be enough to guarantee clean exit - however it does
make the exit more likely to complete successfully, so I think it is a change worth
making. Is there any reason against making the change?

Thinking about this makes me wonder how drlvm will exit cleanly when there is an
OutOfMemoryError when running it from the drlvm launcher. If the heap
is full, surely trying to run shutdown code in VMStart is dangerous anyway?

Regards,
Oliver


[1] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200607.mbox/[EMAIL PROTECTED]

Pavel Pervov wrote:
Hm... I commented on dev-list on this issue already in using classlib
launcher in DRLVM.

JNI specification explicitly states that:
---------------------------------------------------------------------
After an exception has been raised, the native code must first clear the
exception before making other JNI calls. When there is a pending exception,
the only JNI functions that are safe to call are ExceptionOccurred(),
ExceptionDescribe(), and ExceptionClear().
---------------------------------------------------------------------
See [1] at the end of Exception Handling section (and the end of the page).

So, it's nice that VM won't crash if entered JNI function in exception
state, but it is obviously resposibility of native code (launcher in our
case) to check pending exceptions and process them as necessary _before_
calling into JNI.

Regards,
   Pavel Pervov.

[1] http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/design.html#wp770

On 7/20/06, Geir Magnusson Jr (JIRA) <[EMAIL PROTECTED]> wrote:

    [ http://issues.apache.org/jira/browse/HARMONY-927?page=all ]

Geir Magnusson Jr closed HARMONY-927.
-------------------------------------


> DRLVM's DestroyVM needs to be more robust
> -----------------------------------------
>
>                 Key: HARMONY-927
>                 URL: http://issues.apache.org/jira/browse/HARMONY-927
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Andrey Chernyshev
>         Assigned To: Geir Magnusson Jr
>         Attachments: destroy_vm.patch
>
>
> drlvm should handle the fact that an exception already exists on
entering DestroyJavaVM, and clear it before trying to resolve the VMStart
class.
> Here is a small patch that adds a simple check into the shutdown method.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira





--
Oliver Deakin
IBM United Kingdom Limited


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to