harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregory Shimansky <gshiman...@gmail.com>
Subject Re: [testing][drlvm] smoke test gc.WeakReferenceTest failed today on winXP
Date Thu, 08 Feb 2007 12:28:04 GMT
Elena Semukhina wrote:
> On 2/8/07, Gregory Shimansky <gshimansky@gmail.com> wrote:
>>
>> Elena Semukhina wrote:
>> > On 2/7/07, Salikh Zakirov <Salikh.Zakirov@intel.com> wrote:
>> >>
>> >> Gregory Shimansky wrote:
>> >> > Elena Semukhina wrote:
>> >> >> I managed to reproduce the failure on my Windows XP laptop. W'd
>> >> >> suggest that
>> >> >> we change the test so that it waits a little after gc() as Pavel
>> >> pointed
>> >> >> out.
>> >> >
>> >> > Spec says in [1] that
>> >> >
>> >> > -------------------
>> >> > Some time after the garbage collector determines that the
>> reachability
>> >> > of the referent has changed to the value corresponding to the 
>> type of
>> >> > the reference, it will add the reference to the associated queue. At
>> >> > this point, the reference is considered to be enqueued.
>> >> > -------------------
>> >> >
>> >> > The problem is with defining "some time". If spec says nothing about
>> >> how
>> >> > much time later the reference is enqueued, then it is not 
>> possible to
>> >> > test such event consistently. I am afraid this test is simply
>> incorrect
>> >> > and cannot be used.
>> >> >
>> >> > [1]
>> >> >
>> >>
>> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ref/package-summary.html 
>>
>> >>
>> >>
>> >> I would suggest defining "some time" as a call to
>> System.runFinalization
>> >> ().
>> >> It's specification does not mention weak references at all, but it is
>> >> highly
>> >> likely that finalization subsystem is coupled with weak references
>> >> handling,
>> >> so expectation of references being enqueued together with finalization
>> >> is not ungrounded.
>> >> At least on DRLVM, this should work.
>> >>
>> >> And again, if the references wasn't enqueued after
>> >>
>> >>    System.gc(); System.runFinalization();
>> >>
>> >> on DRLVM, then it would look like a real bug.
>> >>
>> >>
>> > I tried this approach and it seems working on DRLVM. I ran tests many
>> times
>> > and they always passed. Do we all agree to change WeakReferenceTest and
>> > PhantomReferenceTest so that to remove sleep() at all and add
>> > System.runFinalization() instead?
>>
>> +1 for this. Using sleep in tests always makes me allergic.
> 
> 
> 
> https://issues.apache.org/jira/browse/HARMONY-3137 created. Please review!

Thank you Elena. I've committed it at revision 504869.

-- 
Gregory


Mime
View raw message