You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Tony Wu <wu...@gmail.com> on 2006/10/30 04:03:27 UTC

[classlib][IBMVME]the return value of java.exe

Consider this class,
public class TestExeReturn {
    public static void main(String[] args) throws Exception {
        throw new Exception();
    }
}

when we run "java TestExeReturn" and "echo %errorlevel%", we got 1 of
RI, -1 of DRLVM and 0 for IBMVM.

a testcase of apache ant failed for this issue.

-- 
Tony Wu
China Software Development Lab, IBM

Re: [classlib][IBMVME]the return value of java.exe

Posted by Gregory Shimansky <gs...@gmail.com>.
On Tuesday 31 October 2006 16:39 Evgueni Brevnov wrote:
> My experiments show that System.exit() terminate the whole process on
> RI not only running VM. Do we all agree this is how it should work?
> Does this affect embedded VMs in a negative way?

I think that any process that runs JVM in itself and doesn't want to be killed 
by its System.exit call can use SecurityManager to make it throw 
SecurityException. I am quite sure that's what a java applet will get if it 
tries to use System.exit.

-- 
Gregory Shimansky, Intel Middleware Products Division

Re: [classlib][IBMVME]the return value of java.exe

Posted by Evgueni Brevnov <ev...@gmail.com>.
My experiments show that System.exit() terminate the whole process on
RI not only running VM. Do we all agree this is how it should work?
Does this affect embedded VMs in a negative way?

Evgueni.

On 10/30/06, Alexey Varlamov <al...@gmail.com> wrote:
> 2006/10/30, Evgueni Brevnov <ev...@gmail.com>:
> > Hi,
> >
> > https://issues.apache.org/jira/browse/HARMONY-2006 is created with
> > patches :-). I created two separate patches one for DRLVM another one
> > for Classlib. I don't know if IBMVME requires additional changes. Even
> > though DestroyJavaVM will not terminate the whole process now it still
> > doesn't clean up resources properly. I'm going to focus on that
> > problem...but it seems to take much more than one day :-)
> >
> > Thanks
> > Evgueni.
> >
> > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > > Tim,
> > >
> > > I agree, we shouldn't kill entire process. Unfortunately, it is how
> > > current implementation does. Actually, shutdown process is a weak
> > > place of DRLVM and needs deep refactoring. I will try to figure out
> > > what we can do as a short term solution.
> > >
> > > Evgueni
> > >
> > > On 10/30/06, Tim Ellison <t....@gmail.com> wrote:
> > > > Evgueni Brevnov wrote:
> > > > > BTW, here is two more interesting cases
> > > > >
> > > > > 1) Throw uncaught exception in a new thread. Both RI and DRLVM give 0
> > > > > in that case.
> Interesting, I guess it does not depend on which Java thread
> terminates last, only main is counted? Looks a bit inconsistent...
>
> > > > > 2) Call System.exit(123) in a new thread. Both RI and DRLVM give 123.
> > > > >
> > > > > Currently, DRLVM calls system _exit() at the end of System.exit().
> > > > > That's why DestroyJavaVM never returns. So the changes I proposed for
> > > > > the launcher do not help until DRLVM forcibly terminates the process.
> > > > > :-(
> > > > >
> > > > > Does IBMVME uses system calls to stop the proccess? Does DestroyJavaVM
> > > > > returns?
> > > >
> Seems that explicit call to System.exit() and natural termination
> (even by uncaught throwable) are different use cases and need separate
> handling.
>
> > > > You cannot kill the entire process when destroying the VM.  Apps that
> > > > embed the VM will have a nasty surprise.
>
> Is it the case for System.exit()/halt() ? Given the test result above,
> I suspect RI and J9 just kill the process.
>
> > > >
> > > > Regards,
> > > > Tim
> > > >
> > > > > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > > > >> It seems we need to fix the launcher... which is common part for both
> > > > >> DRLVM and IBVME. I see the problem in the following code sequence...
> > > > >>
> > > > >> <snip>
> > > > >>  (*jvm)->DetachCurrentThread(jvm);
> > > > >>  (*jvm)->DestroyJavaVM (jvm);
> > > > >> </snip>
> > > > >>
> > > > >> The current thread has an uncaught exception raised before it calls
> > > > >> DetachCurrentThread. This exception is printed out by default uncaught
> > > > >> exception handler which is called upon thread detaching. So after
> > > > >> DetachCurrentThread completes we have no exception anymore... Moreover
> > > > >> we can not play with DetachCurrentThread and DestroyJavaVM return code
> > > > >> since it should not depend on uncaught exceptions. So I think the fix
> > > > >> should look like the following:
> > > > >>
> > > > >> <snip>
> > > > >>   if (env->ExceptionOccured) {
> > > > >>        rc = 1;
> > > > >>   }
> > > > >>  (*jvm)->DetachCurrentThread(jvm);
> > > > >>  (*jvm)->DestroyJavaVM (jvm);
> > > > >>  return rc;
> > > > >> </snip>
> > > > >>
> > > > >> If there are no objections I'll come up with the patch soon...
> > > > >>
> > > > >> Thanks
> > > > >> Evgueni
> > > > >> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > > > >> > I'll try to see how to fix it for DRLVM
> > > > >> >
> > > > >> > Evgueni
> > > > >> >
> > > > >> > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > > > >> > > hmmm.... I got 0 for DRLVM on Win2003
> > > > >> > >
> > > > >> > > Evgueni
> > > > >> > >
> > > > >> > > On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> > > > >> > > > Then we may need to follow RI, since different error code fails
> > > > >> application
> > > > >> > > >
> > > > >> > > > Best regards
> > > > >> > > > Tony Wu ??:
> > > > >> > > > > Consider this class,
> > > > >> > > > > public class TestExeReturn {
> > > > >> > > > > public static void main(String[] args) throws Exception {
> > > > >> > > > > throw new Exception();
> > > > >> > > > > }
> > > > >> > > > > }
> > > > >> > > > >
> > > > >> > > > > when we run "java TestExeReturn" and "echo %errorlevel%", we
> > > > >> got 1 of
> > > > >> > > > > RI, -1 of DRLVM and 0 for IBMVM.
> > > > >> > > > >
> > > > >> > > > > a testcase of apache ant failed for this issue.
> > > > >> > > > >
> > > > >> > > >
> > > > >> > > >
> > > > >> > > > --
> > > > >> > > > Spark Shen
> > > > >> > > > China Software Development Lab, IBM
> > > > >> > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > > >
> > > >
> > > > --
> > > >
> > > > Tim Ellison (t.p.ellison@gmail.com)
> > > >
> > > >
> > >
> >
>

Re: [classlib][IBMVME]the return value of java.exe

Posted by Alexey Varlamov <al...@gmail.com>.
2006/10/30, Evgueni Brevnov <ev...@gmail.com>:
> Hi,
>
> https://issues.apache.org/jira/browse/HARMONY-2006 is created with
> patches :-). I created two separate patches one for DRLVM another one
> for Classlib. I don't know if IBMVME requires additional changes. Even
> though DestroyJavaVM will not terminate the whole process now it still
> doesn't clean up resources properly. I'm going to focus on that
> problem...but it seems to take much more than one day :-)
>
> Thanks
> Evgueni.
>
> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > Tim,
> >
> > I agree, we shouldn't kill entire process. Unfortunately, it is how
> > current implementation does. Actually, shutdown process is a weak
> > place of DRLVM and needs deep refactoring. I will try to figure out
> > what we can do as a short term solution.
> >
> > Evgueni
> >
> > On 10/30/06, Tim Ellison <t....@gmail.com> wrote:
> > > Evgueni Brevnov wrote:
> > > > BTW, here is two more interesting cases
> > > >
> > > > 1) Throw uncaught exception in a new thread. Both RI and DRLVM give 0
> > > > in that case.
Interesting, I guess it does not depend on which Java thread
terminates last, only main is counted? Looks a bit inconsistent...

> > > > 2) Call System.exit(123) in a new thread. Both RI and DRLVM give 123.
> > > >
> > > > Currently, DRLVM calls system _exit() at the end of System.exit().
> > > > That's why DestroyJavaVM never returns. So the changes I proposed for
> > > > the launcher do not help until DRLVM forcibly terminates the process.
> > > > :-(
> > > >
> > > > Does IBMVME uses system calls to stop the proccess? Does DestroyJavaVM
> > > > returns?
> > >
Seems that explicit call to System.exit() and natural termination
(even by uncaught throwable) are different use cases and need separate
handling.

> > > You cannot kill the entire process when destroying the VM.  Apps that
> > > embed the VM will have a nasty surprise.

Is it the case for System.exit()/halt() ? Given the test result above,
I suspect RI and J9 just kill the process.

> > >
> > > Regards,
> > > Tim
> > >
> > > > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > > >> It seems we need to fix the launcher... which is common part for both
> > > >> DRLVM and IBVME. I see the problem in the following code sequence...
> > > >>
> > > >> <snip>
> > > >>  (*jvm)->DetachCurrentThread(jvm);
> > > >>  (*jvm)->DestroyJavaVM (jvm);
> > > >> </snip>
> > > >>
> > > >> The current thread has an uncaught exception raised before it calls
> > > >> DetachCurrentThread. This exception is printed out by default uncaught
> > > >> exception handler which is called upon thread detaching. So after
> > > >> DetachCurrentThread completes we have no exception anymore... Moreover
> > > >> we can not play with DetachCurrentThread and DestroyJavaVM return code
> > > >> since it should not depend on uncaught exceptions. So I think the fix
> > > >> should look like the following:
> > > >>
> > > >> <snip>
> > > >>   if (env->ExceptionOccured) {
> > > >>        rc = 1;
> > > >>   }
> > > >>  (*jvm)->DetachCurrentThread(jvm);
> > > >>  (*jvm)->DestroyJavaVM (jvm);
> > > >>  return rc;
> > > >> </snip>
> > > >>
> > > >> If there are no objections I'll come up with the patch soon...
> > > >>
> > > >> Thanks
> > > >> Evgueni
> > > >> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > > >> > I'll try to see how to fix it for DRLVM
> > > >> >
> > > >> > Evgueni
> > > >> >
> > > >> > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > > >> > > hmmm.... I got 0 for DRLVM on Win2003
> > > >> > >
> > > >> > > Evgueni
> > > >> > >
> > > >> > > On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> > > >> > > > Then we may need to follow RI, since different error code fails
> > > >> application
> > > >> > > >
> > > >> > > > Best regards
> > > >> > > > Tony Wu ??:
> > > >> > > > > Consider this class,
> > > >> > > > > public class TestExeReturn {
> > > >> > > > > public static void main(String[] args) throws Exception {
> > > >> > > > > throw new Exception();
> > > >> > > > > }
> > > >> > > > > }
> > > >> > > > >
> > > >> > > > > when we run "java TestExeReturn" and "echo %errorlevel%", we
> > > >> got 1 of
> > > >> > > > > RI, -1 of DRLVM and 0 for IBMVM.
> > > >> > > > >
> > > >> > > > > a testcase of apache ant failed for this issue.
> > > >> > > > >
> > > >> > > >
> > > >> > > >
> > > >> > > > --
> > > >> > > > Spark Shen
> > > >> > > > China Software Development Lab, IBM
> > > >> > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > > >
> > >
> > > --
> > >
> > > Tim Ellison (t.p.ellison@gmail.com)
> > >
> > >
> >
>

Re: [classlib][IBMVME]the return value of java.exe

Posted by Evgueni Brevnov <ev...@gmail.com>.
Hi,

https://issues.apache.org/jira/browse/HARMONY-2006 is created with
patches :-). I created two separate patches one for DRLVM another one
for Classlib. I don't know if IBMVME requires additional changes. Even
though DestroyJavaVM will not terminate the whole process now it still
doesn't clean up resources properly. I'm going to focus on that
problem...but it seems to take much more than one day :-)

Thanks
Evgueni.

On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> Tim,
>
> I agree, we shouldn't kill entire process. Unfortunately, it is how
> current implementation does. Actually, shutdown process is a weak
> place of DRLVM and needs deep refactoring. I will try to figure out
> what we can do as a short term solution.
>
> Evgueni
>
> On 10/30/06, Tim Ellison <t....@gmail.com> wrote:
> > Evgueni Brevnov wrote:
> > > BTW, here is two more interesting cases
> > >
> > > 1) Throw uncaught exception in a new thread. Both RI and DRLVM give 0
> > > in that case.
> > > 2) Call System.exit(123) in a new thread. Both RI and DRLVM give 123.
> > >
> > > Currently, DRLVM calls system _exit() at the end of System.exit().
> > > That's why DestroyJavaVM never returns. So the changes I proposed for
> > > the launcher do not help until DRLVM forcibly terminates the process.
> > > :-(
> > >
> > > Does IBMVME uses system calls to stop the proccess? Does DestroyJavaVM
> > > returns?
> >
> > You cannot kill the entire process when destroying the VM.  Apps that
> > embed the VM will have a nasty surprise.
> >
> > Regards,
> > Tim
> >
> > > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > >> It seems we need to fix the launcher... which is common part for both
> > >> DRLVM and IBVME. I see the problem in the following code sequence...
> > >>
> > >> <snip>
> > >>  (*jvm)->DetachCurrentThread(jvm);
> > >>  (*jvm)->DestroyJavaVM (jvm);
> > >> </snip>
> > >>
> > >> The current thread has an uncaught exception raised before it calls
> > >> DetachCurrentThread. This exception is printed out by default uncaught
> > >> exception handler which is called upon thread detaching. So after
> > >> DetachCurrentThread completes we have no exception anymore... Moreover
> > >> we can not play with DetachCurrentThread and DestroyJavaVM return code
> > >> since it should not depend on uncaught exceptions. So I think the fix
> > >> should look like the following:
> > >>
> > >> <snip>
> > >>   if (env->ExceptionOccured) {
> > >>        rc = 1;
> > >>   }
> > >>  (*jvm)->DetachCurrentThread(jvm);
> > >>  (*jvm)->DestroyJavaVM (jvm);
> > >>  return rc;
> > >> </snip>
> > >>
> > >> If there are no objections I'll come up with the patch soon...
> > >>
> > >> Thanks
> > >> Evgueni
> > >> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > >> > I'll try to see how to fix it for DRLVM
> > >> >
> > >> > Evgueni
> > >> >
> > >> > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > >> > > hmmm.... I got 0 for DRLVM on Win2003
> > >> > >
> > >> > > Evgueni
> > >> > >
> > >> > > On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> > >> > > > Then we may need to follow RI, since different error code fails
> > >> application
> > >> > > >
> > >> > > > Best regards
> > >> > > > Tony Wu ??:
> > >> > > > > Consider this class,
> > >> > > > > public class TestExeReturn {
> > >> > > > > public static void main(String[] args) throws Exception {
> > >> > > > > throw new Exception();
> > >> > > > > }
> > >> > > > > }
> > >> > > > >
> > >> > > > > when we run "java TestExeReturn" and "echo %errorlevel%", we
> > >> got 1 of
> > >> > > > > RI, -1 of DRLVM and 0 for IBMVM.
> > >> > > > >
> > >> > > > > a testcase of apache ant failed for this issue.
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > > --
> > >> > > > Spark Shen
> > >> > > > China Software Development Lab, IBM
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >
> >
> > --
> >
> > Tim Ellison (t.p.ellison@gmail.com)
> >
> >
>

Re: [classlib][IBMVME]the return value of java.exe

Posted by Evgueni Brevnov <ev...@gmail.com>.
Tim,

I agree, we shouldn't kill entire process. Unfortunately, it is how
current implementation does. Actually, shutdown process is a weak
place of DRLVM and needs deep refactoring. I will try to figure out
what we can do as a short term solution.

Evgueni

On 10/30/06, Tim Ellison <t....@gmail.com> wrote:
> Evgueni Brevnov wrote:
> > BTW, here is two more interesting cases
> >
> > 1) Throw uncaught exception in a new thread. Both RI and DRLVM give 0
> > in that case.
> > 2) Call System.exit(123) in a new thread. Both RI and DRLVM give 123.
> >
> > Currently, DRLVM calls system _exit() at the end of System.exit().
> > That's why DestroyJavaVM never returns. So the changes I proposed for
> > the launcher do not help until DRLVM forcibly terminates the process.
> > :-(
> >
> > Does IBMVME uses system calls to stop the proccess? Does DestroyJavaVM
> > returns?
>
> You cannot kill the entire process when destroying the VM.  Apps that
> embed the VM will have a nasty surprise.
>
> Regards,
> Tim
>
> > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> >> It seems we need to fix the launcher... which is common part for both
> >> DRLVM and IBVME. I see the problem in the following code sequence...
> >>
> >> <snip>
> >>  (*jvm)->DetachCurrentThread(jvm);
> >>  (*jvm)->DestroyJavaVM (jvm);
> >> </snip>
> >>
> >> The current thread has an uncaught exception raised before it calls
> >> DetachCurrentThread. This exception is printed out by default uncaught
> >> exception handler which is called upon thread detaching. So after
> >> DetachCurrentThread completes we have no exception anymore... Moreover
> >> we can not play with DetachCurrentThread and DestroyJavaVM return code
> >> since it should not depend on uncaught exceptions. So I think the fix
> >> should look like the following:
> >>
> >> <snip>
> >>   if (env->ExceptionOccured) {
> >>        rc = 1;
> >>   }
> >>  (*jvm)->DetachCurrentThread(jvm);
> >>  (*jvm)->DestroyJavaVM (jvm);
> >>  return rc;
> >> </snip>
> >>
> >> If there are no objections I'll come up with the patch soon...
> >>
> >> Thanks
> >> Evgueni
> >> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> >> > I'll try to see how to fix it for DRLVM
> >> >
> >> > Evgueni
> >> >
> >> > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> >> > > hmmm.... I got 0 for DRLVM on Win2003
> >> > >
> >> > > Evgueni
> >> > >
> >> > > On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> >> > > > Then we may need to follow RI, since different error code fails
> >> application
> >> > > >
> >> > > > Best regards
> >> > > > Tony Wu ??:
> >> > > > > Consider this class,
> >> > > > > public class TestExeReturn {
> >> > > > > public static void main(String[] args) throws Exception {
> >> > > > > throw new Exception();
> >> > > > > }
> >> > > > > }
> >> > > > >
> >> > > > > when we run "java TestExeReturn" and "echo %errorlevel%", we
> >> got 1 of
> >> > > > > RI, -1 of DRLVM and 0 for IBMVM.
> >> > > > >
> >> > > > > a testcase of apache ant failed for this issue.
> >> > > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > > Spark Shen
> >> > > > China Software Development Lab, IBM
> >> > > >
> >> > > >
> >> > >
> >> >
> >>
> >
>
> --
>
> Tim Ellison (t.p.ellison@gmail.com)
>
>

Re: [classlib][IBMVME]the return value of java.exe

Posted by Tim Ellison <t....@gmail.com>.
Evgueni Brevnov wrote:
> BTW, here is two more interesting cases
> 
> 1) Throw uncaught exception in a new thread. Both RI and DRLVM give 0
> in that case.
> 2) Call System.exit(123) in a new thread. Both RI and DRLVM give 123.
> 
> Currently, DRLVM calls system _exit() at the end of System.exit().
> That's why DestroyJavaVM never returns. So the changes I proposed for
> the launcher do not help until DRLVM forcibly terminates the process.
> :-(
> 
> Does IBMVME uses system calls to stop the proccess? Does DestroyJavaVM
> returns?

You cannot kill the entire process when destroying the VM.  Apps that
embed the VM will have a nasty surprise.

Regards,
Tim

> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
>> It seems we need to fix the launcher... which is common part for both
>> DRLVM and IBVME. I see the problem in the following code sequence...
>>
>> <snip>
>>  (*jvm)->DetachCurrentThread(jvm);
>>  (*jvm)->DestroyJavaVM (jvm);
>> </snip>
>>
>> The current thread has an uncaught exception raised before it calls
>> DetachCurrentThread. This exception is printed out by default uncaught
>> exception handler which is called upon thread detaching. So after
>> DetachCurrentThread completes we have no exception anymore... Moreover
>> we can not play with DetachCurrentThread and DestroyJavaVM return code
>> since it should not depend on uncaught exceptions. So I think the fix
>> should look like the following:
>>
>> <snip>
>>   if (env->ExceptionOccured) {
>>        rc = 1;
>>   }
>>  (*jvm)->DetachCurrentThread(jvm);
>>  (*jvm)->DestroyJavaVM (jvm);
>>  return rc;
>> </snip>
>>
>> If there are no objections I'll come up with the patch soon...
>>
>> Thanks
>> Evgueni
>> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
>> > I'll try to see how to fix it for DRLVM
>> >
>> > Evgueni
>> >
>> > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
>> > > hmmm.... I got 0 for DRLVM on Win2003
>> > >
>> > > Evgueni
>> > >
>> > > On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
>> > > > Then we may need to follow RI, since different error code fails
>> application
>> > > >
>> > > > Best regards
>> > > > Tony Wu ??:
>> > > > > Consider this class,
>> > > > > public class TestExeReturn {
>> > > > > public static void main(String[] args) throws Exception {
>> > > > > throw new Exception();
>> > > > > }
>> > > > > }
>> > > > >
>> > > > > when we run "java TestExeReturn" and "echo %errorlevel%", we
>> got 1 of
>> > > > > RI, -1 of DRLVM and 0 for IBMVM.
>> > > > >
>> > > > > a testcase of apache ant failed for this issue.
>> > > > >
>> > > >
>> > > >
>> > > > --
>> > > > Spark Shen
>> > > > China Software Development Lab, IBM
>> > > >
>> > > >
>> > >
>> >
>>
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)


Re: [classlib][IBMVME]the return value of java.exe

Posted by Evgueni Brevnov <ev...@gmail.com>.
BTW, here is two more interesting cases

1) Throw uncaught exception in a new thread. Both RI and DRLVM give 0
in that case.
2) Call System.exit(123) in a new thread. Both RI and DRLVM give 123.

Currently, DRLVM calls system _exit() at the end of System.exit().
That's why DestroyJavaVM never returns. So the changes I proposed for
the launcher do not help until DRLVM forcibly terminates the process.
:-(

Does IBMVME uses system calls to stop the proccess? Does DestroyJavaVM returns?

Evgueni


On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> It seems we need to fix the launcher... which is common part for both
> DRLVM and IBVME. I see the problem in the following code sequence...
>
> <snip>
>  (*jvm)->DetachCurrentThread(jvm);
>  (*jvm)->DestroyJavaVM (jvm);
> </snip>
>
> The current thread has an uncaught exception raised before it calls
> DetachCurrentThread. This exception is printed out by default uncaught
> exception handler which is called upon thread detaching. So after
> DetachCurrentThread completes we have no exception anymore... Moreover
> we can not play with DetachCurrentThread and DestroyJavaVM return code
> since it should not depend on uncaught exceptions. So I think the fix
> should look like the following:
>
> <snip>
>   if (env->ExceptionOccured) {
>        rc = 1;
>   }
>  (*jvm)->DetachCurrentThread(jvm);
>  (*jvm)->DestroyJavaVM (jvm);
>  return rc;
> </snip>
>
> If there are no objections I'll come up with the patch soon...
>
> Thanks
> Evgueni
> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > I'll try to see how to fix it for DRLVM
> >
> > Evgueni
> >
> > On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > > hmmm.... I got 0 for DRLVM on Win2003
> > >
> > > Evgueni
> > >
> > > On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> > > > Then we may need to follow RI, since different error code fails application
> > > >
> > > > Best regards
> > > > Tony Wu 写道:
> > > > > Consider this class,
> > > > > public class TestExeReturn {
> > > > > public static void main(String[] args) throws Exception {
> > > > > throw new Exception();
> > > > > }
> > > > > }
> > > > >
> > > > > when we run "java TestExeReturn" and "echo %errorlevel%", we got 1 of
> > > > > RI, -1 of DRLVM and 0 for IBMVM.
> > > > >
> > > > > a testcase of apache ant failed for this issue.
> > > > >
> > > >
> > > >
> > > > --
> > > > Spark Shen
> > > > China Software Development Lab, IBM
> > > >
> > > >
> > >
> >
>

Re: [classlib][IBMVME]the return value of java.exe

Posted by Evgueni Brevnov <ev...@gmail.com>.
It seems we need to fix the launcher... which is common part for both
DRLVM and IBVME. I see the problem in the following code sequence...

<snip>
  (*jvm)->DetachCurrentThread(jvm);
  (*jvm)->DestroyJavaVM (jvm);
</snip>

The current thread has an uncaught exception raised before it calls
DetachCurrentThread. This exception is printed out by default uncaught
exception handler which is called upon thread detaching. So after
DetachCurrentThread completes we have no exception anymore... Moreover
we can not play with DetachCurrentThread and DestroyJavaVM return code
since it should not depend on uncaught exceptions. So I think the fix
should look like the following:

<snip>
   if (env->ExceptionOccured) {
        rc = 1;
   }
  (*jvm)->DetachCurrentThread(jvm);
  (*jvm)->DestroyJavaVM (jvm);
  return rc;
</snip>

If there are no objections I'll come up with the patch soon...

Thanks
Evgueni
On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> I'll try to see how to fix it for DRLVM
>
> Evgueni
>
> On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> > hmmm.... I got 0 for DRLVM on Win2003
> >
> > Evgueni
> >
> > On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> > > Then we may need to follow RI, since different error code fails application
> > >
> > > Best regards
> > > Tony Wu 写道:
> > > > Consider this class,
> > > > public class TestExeReturn {
> > > > public static void main(String[] args) throws Exception {
> > > > throw new Exception();
> > > > }
> > > > }
> > > >
> > > > when we run "java TestExeReturn" and "echo %errorlevel%", we got 1 of
> > > > RI, -1 of DRLVM and 0 for IBMVM.
> > > >
> > > > a testcase of apache ant failed for this issue.
> > > >
> > >
> > >
> > > --
> > > Spark Shen
> > > China Software Development Lab, IBM
> > >
> > >
> >
>

Re: [classlib][IBMVME]the return value of java.exe

Posted by Evgueni Brevnov <ev...@gmail.com>.
I'll try to see how to fix it for DRLVM

Evgueni

On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> hmmm.... I got 0 for DRLVM on Win2003
>
> Evgueni
>
> On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> > Then we may need to follow RI, since different error code fails application
> >
> > Best regards
> > Tony Wu 写道:
> > > Consider this class,
> > > public class TestExeReturn {
> > > public static void main(String[] args) throws Exception {
> > > throw new Exception();
> > > }
> > > }
> > >
> > > when we run "java TestExeReturn" and "echo %errorlevel%", we got 1 of
> > > RI, -1 of DRLVM and 0 for IBMVM.
> > >
> > > a testcase of apache ant failed for this issue.
> > >
> >
> >
> > --
> > Spark Shen
> > China Software Development Lab, IBM
> >
> >
>

Re: [classlib][IBMVME]the return value of java.exe

Posted by Tony Wu <wu...@gmail.com>.
Anyway it should not be 0 when throws exception I think. I tried on
drlvm on xp sp2, it returns -1. my drlvm version is 453419.

On 10/30/06, Evgueni Brevnov <ev...@gmail.com> wrote:
> hmmm.... I got 0 for DRLVM on Win2003
>
> Evgueni
>
> On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> > Then we may need to follow RI, since different error code fails application
> >
> > Best regards
> > Tony Wu 写道:
> > > Consider this class,
> > > public class TestExeReturn {
> > > public static void main(String[] args) throws Exception {
> > > throw new Exception();
> > > }
> > > }
> > >
> > > when we run "java TestExeReturn" and "echo %errorlevel%", we got 1 of
> > > RI, -1 of DRLVM and 0 for IBMVM.
> > >
> > > a testcase of apache ant failed for this issue.
> > >
> >
> >
> > --
> > Spark Shen
> > China Software Development Lab, IBM
> >
> >
>


-- 
Tony Wu
China Software Development Lab, IBM

Re: [classlib][IBMVME]the return value of java.exe

Posted by Evgueni Brevnov <ev...@gmail.com>.
hmmm.... I got 0 for DRLVM on Win2003

Evgueni

On 10/30/06, Spark Shen <sm...@gmail.com> wrote:
> Then we may need to follow RI, since different error code fails application
>
> Best regards
> Tony Wu 写道:
> > Consider this class,
> > public class TestExeReturn {
> > public static void main(String[] args) throws Exception {
> > throw new Exception();
> > }
> > }
> >
> > when we run "java TestExeReturn" and "echo %errorlevel%", we got 1 of
> > RI, -1 of DRLVM and 0 for IBMVM.
> >
> > a testcase of apache ant failed for this issue.
> >
>
>
> --
> Spark Shen
> China Software Development Lab, IBM
>
>

Re: [classlib][IBMVME]the return value of java.exe

Posted by Spark Shen <sm...@gmail.com>.
Then we may need to follow RI, since different error code fails application

Best regards
Tony Wu 写道:
> Consider this class,
> public class TestExeReturn {
> public static void main(String[] args) throws Exception {
> throw new Exception();
> }
> }
>
> when we run "java TestExeReturn" and "echo %errorlevel%", we got 1 of
> RI, -1 of DRLVM and 0 for IBMVM.
>
> a testcase of apache ant failed for this issue.
>


-- 
Spark Shen
China Software Development Lab, IBM