You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Salikh Zakirov <Sa...@Intel.com> on 2007/02/07 14:30:17 UTC

Re: [testing][drlvm] smoke test gc.WeakReferenceTest failed today on winXP

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.


Re: [testing][drlvm] smoke test gc.WeakReferenceTest failed today on winXP

Posted by Gregory Shimansky <gs...@gmail.com>.
Elena Semukhina wrote:
> On 2/8/07, Gregory Shimansky <gs...@gmail.com> wrote:
>>
>> Elena Semukhina wrote:
>> > On 2/7/07, Salikh Zakirov <Sa...@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


Re: [testing][drlvm] smoke test gc.WeakReferenceTest failed today on winXP

Posted by Elena Semukhina <el...@gmail.com>.
On 2/8/07, Gregory Shimansky <gs...@gmail.com> wrote:
>
> Elena Semukhina wrote:
> > On 2/7/07, Salikh Zakirov <Sa...@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!

Elena

--
> Gregory
>
>


-- 
Thanks,
Elena

Re: [testing][drlvm] smoke test gc.WeakReferenceTest failed today on winXP

Posted by Gregory Shimansky <gs...@gmail.com>.
Elena Semukhina wrote:
> On 2/7/07, Salikh Zakirov <Sa...@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.

-- 
Gregory


Re: [testing][drlvm] smoke test gc.WeakReferenceTest failed today on winXP

Posted by Elena Semukhina <el...@gmail.com>.
On 2/7/07, Salikh Zakirov <Sa...@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?

Elena

-- 
Thanks,
Elena