Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 13489 invoked from network); 28 Dec 2007 15:42:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Dec 2007 15:42:03 -0000 Received: (qmail 69532 invoked by uid 500); 28 Dec 2007 15:41:52 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 69513 invoked by uid 500); 28 Dec 2007 15:41:52 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 69504 invoked by uid 99); 28 Dec 2007 15:41:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Dec 2007 07:41:52 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Dec 2007 15:41:38 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 040117141FE for ; Fri, 28 Dec 2007 07:41:43 -0800 (PST) Message-ID: <27442058.1198856503006.JavaMail.jira@brutus> Date: Fri, 28 Dec 2007 07:41:43 -0800 (PST) From: "Mikhail Markov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-3917) [buildtest][smoke]gc.WeakReferenceTest & gc.PhantomReferenceTest in drlvm smoke test expect more than Java API spec requires In-Reply-To: <9163492.1179729796353.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-3917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mikhail Markov updated HARMONY-3917: ------------------------------------ Component/s: (was: DRLVM) build - test - ci Summary: [buildtest][smoke]gc.WeakReferenceTest & gc.PhantomReferenceTest in drlvm smoke test expect more than Java API spec requires (was: [drlvm][test]gc.WeakReferenceTest & gc.PhantomReferenceTest in drlvm smoke test expect more than Java API spec requires) > [buildtest][smoke]gc.WeakReferenceTest & gc.PhantomReferenceTest in drlvm smoke test expect more than Java API spec requires > ---------------------------------------------------------------------------------------------------------------------------- > > Key: HARMONY-3917 > URL: https://issues.apache.org/jira/browse/HARMONY-3917 > Project: Harmony > Issue Type: Bug > Components: build - test - ci > Environment: Win/Linux 32/64 > Reporter: Li-Gang Wang > Attachments: 01_weakref.patch, ex.update.patch > > > The two test cases metioned in title have the following code segment: > public static void main(String[] args) throws Exception { > ReferenceQueue queue = new ReferenceQueue(); > Object referent = new WeakReferenceTest(); > Reference ref = new WeakReference(referent, queue); > if (ref.get() != referent) { > System.out.println("FAIL: can't get weak referent"); > return; > } > // drop strong reference > referent = null; > System.gc(); > > // run finalization to be sure that the reference is enqueued > System.runFinalization(); > > Reference enqueued; > enqueued = queue.poll(); > if (enqueued == null) { > System.out.println("FAIL: reference was not enqueued"); > return; > } > if (ref.get() != null) { > System.out.println("FAIL: reference was not cleared."); > return; > } > if (enqueued.get() != null) { > System.out.println("FAIL: reference was not cleared."); > return; > } > System.out.println("PASS"); > } > They assume the weak reference has been enqueued after System.gc() and System.runFinalization() are called. In fact in spec the first API does not guarantee that every unused object in heap is recycled, and the second API does not guarantee every weak reference is enqueued if its referent becomes weakly reachable. This issue has been discussed in Harmony mailing list. Its title is > [classlib][testcase] should weakreference be queued in runFinalization()? [http://mail-archives.apache.org/mod_mbox/harmony-dev/200704.mbox/%3c9623c9a50704121937w56c8f045t35fba03ac80f2d59@mail.gmail.com%3e] > Because of their wrong assumption, they may fail intermittently. I suggest them to be rewritten according to the spec. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.