Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 74103 invoked from network); 30 Oct 2006 14:01:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2006 14:01:28 -0000 Received: (qmail 22588 invoked by uid 500); 30 Oct 2006 14:01:29 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 22536 invoked by uid 500); 30 Oct 2006 14:01:29 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 22515 invoked by uid 99); 30 Oct 2006 14:01:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Oct 2006 06:01:29 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of alexey.v.varlamov@gmail.com designates 66.249.82.231 as permitted sender) Received: from [66.249.82.231] (HELO wx-out-0506.google.com) (66.249.82.231) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Oct 2006 06:01:15 -0800 Received: by wx-out-0506.google.com with SMTP id s13so1411732wxc for ; Mon, 30 Oct 2006 06:00:54 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=txCsw8QRYejRHOrR6sfPBjMA0DM+3U5Eon6qa96uRAl62wNJMY/e0Txlh2PmGx8kOgjKRr26ptu/cn+D2kygc2ftYRwd7hMr3vpu/zD7TKfsbG5D1tYK9uYyETkp8jxZEEhJFfMzJxliltQHRMknarXyyRbe+sJVqfDwxBFEDOY= Received: by 10.70.65.8 with SMTP id n8mr4979317wxa; Mon, 30 Oct 2006 06:00:54 -0800 (PST) Received: by 10.70.50.2 with HTTP; Mon, 30 Oct 2006 06:00:54 -0800 (PST) Message-ID: Date: Mon, 30 Oct 2006 21:00:54 +0700 From: "Alexey Varlamov" To: harmony-dev@incubator.apache.org Subject: Re: [classlib][IBMVME]the return value of java.exe In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <211709bc0610291903i29eb7be2yd91e4a47dcd89933@mail.gmail.com> <4545718E.5080208@gmail.com> <4545C1A3.3020705@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org 2006/10/30, Evgueni Brevnov : > 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 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 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 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... > > > >> > > > >> > > > >> (*jvm)->DetachCurrentThread(jvm); > > > >> (*jvm)->DestroyJavaVM (jvm); > > > >> > > > >> > > > >> 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: > > > >> > > > >> > > > >> if (env->ExceptionOccured) { > > > >> rc = 1; > > > >> } > > > >> (*jvm)->DetachCurrentThread(jvm); > > > >> (*jvm)->DestroyJavaVM (jvm); > > > >> return rc; > > > >> > > > >> > > > >> If there are no objections I'll come up with the patch soon... > > > >> > > > >> Thanks > > > >> Evgueni > > > >> On 10/30/06, Evgueni Brevnov wrote: > > > >> > I'll try to see how to fix it for DRLVM > > > >> > > > > >> > Evgueni > > > >> > > > > >> > On 10/30/06, Evgueni Brevnov wrote: > > > >> > > hmmm.... I got 0 for DRLVM on Win2003 > > > >> > > > > > >> > > Evgueni > > > >> > > > > > >> > > On 10/30/06, Spark Shen 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) > > > > > > > > >