Finalization tests failing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Finalization tests failing

Igor Stasenko
Hello,

under VM with new finalization, some tests are failing.
Please, check
http://code.google.com/p/pharo/issues/detail?id=3183
for details.

it looks like i need to do a different changeset for Squeak

--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Finalization tests failing

Levente Uzonyi-2
On Sun, 31 Oct 2010, Igor Stasenko wrote:

> Hello,
>
> under VM with new finalization, some tests are failing.
> Please, check
> http://code.google.com/p/pharo/issues/detail?id=3183
> for details.
>
> it looks like i need to do a different changeset for Squeak

Why? Are the tests failing in Squeak? The patches you attached to the
issue are both related to Pharo's crappy WeakKeyDictionary implementation.


Levente

>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Finalization tests failing

Igor Stasenko
On 31 October 2010 05:50, Levente Uzonyi <[hidden email]> wrote:

> On Sun, 31 Oct 2010, Igor Stasenko wrote:
>
>> Hello,
>>
>> under VM with new finalization, some tests are failing.
>> Please, check
>> http://code.google.com/p/pharo/issues/detail?id=3183
>> for details.
>>
>> it looks like i need to do a different changeset for Squeak
>
> Why? Are the tests failing in Squeak? The patches you attached to the issue
> are both related to Pharo's crappy WeakKeyDictionary implementation.
>

i'm afraid no.
Squeak weak dictionary does not overriding associations with nil keys,
which means that it will grow bigger and bigger when you run image
under VM with new finalization.

>
> Levente
>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Finalization tests failing

Levente Uzonyi-2
On Sun, 31 Oct 2010, Igor Stasenko wrote:

> On 31 October 2010 05:50, Levente Uzonyi <[hidden email]> wrote:
>> On Sun, 31 Oct 2010, Igor Stasenko wrote:
>>
>>> Hello,
>>>
>>> under VM with new finalization, some tests are failing.
>>> Please, check
>>> http://code.google.com/p/pharo/issues/detail?id=3183
>>> for details.
>>>
>>> it looks like i need to do a different changeset for Squeak
>>
>> Why? Are the tests failing in Squeak? The patches you attached to the issue
>> are both related to Pharo's crappy WeakKeyDictionary implementation.
>>
>
> i'm afraid no.
> Squeak weak dictionary does not overriding associations with nil keys,
> which means that it will grow bigger and bigger when you run image
> under VM with new finalization.

No, it won't. During growing the associations with nil keys will be
finalized and removed from the WeakKeyDictionary. The same also happens
if you remove an association. In this case the association's chain will be
affected. See #noCheckNoGrowFillFrom: and #fixCollisionsFrom:.

There will be another problem with the current implementation of the new
finalization scheme. Since the new WeakRegistry doesn't remove the
associations from the dictionary, the installed finalizer
(#finalizeValues) will be evaluated with the already finalized
WeakFinalizerItems. This may cause early finalization or raise an error.
The easiest way to avoid this is to use a better finalizer which does
nothing if the VM supports the new finalization scheme.


Levente

>
>>
>> Levente
>>
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>>
>>>
>>
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Finalization tests failing

Igor Stasenko
On 31 October 2010 18:34, Levente Uzonyi <[hidden email]> wrote:

> On Sun, 31 Oct 2010, Igor Stasenko wrote:
>
>> On 31 October 2010 05:50, Levente Uzonyi <[hidden email]> wrote:
>>>
>>> On Sun, 31 Oct 2010, Igor Stasenko wrote:
>>>
>>>> Hello,
>>>>
>>>> under VM with new finalization, some tests are failing.
>>>> Please, check
>>>> http://code.google.com/p/pharo/issues/detail?id=3183
>>>> for details.
>>>>
>>>> it looks like i need to do a different changeset for Squeak
>>>
>>> Why? Are the tests failing in Squeak? The patches you attached to the
>>> issue
>>> are both related to Pharo's crappy WeakKeyDictionary implementation.
>>>
>>
>> i'm afraid no.
>> Squeak weak dictionary does not overriding associations with nil keys,
>> which means that it will grow bigger and bigger when you run image
>> under VM with new finalization.
>
> No, it won't. During growing the associations with nil keys will be
> finalized and removed from the WeakKeyDictionary. The same also happens if
> you remove an association. In this case the association's chain will be
> affected. See #noCheckNoGrowFillFrom: and #fixCollisionsFrom:.

okay.. then there is no need to change anything in Squeak.
Because at either grow or shrink , it will wipe all associations with nil keys.

>
> There will be another problem with the current implementation of the new
> finalization scheme. Since the new WeakRegistry doesn't remove the
> associations from the dictionary, the installed finalizer (#finalizeValues)
> will be evaluated with the already finalized WeakFinalizerItems. This may
> cause early finalization or raise an error. The easiest way to avoid this is
> to use a better finalizer which does nothing if the VM supports the new
> finalization scheme.
>
No, that's actually not a problem. A finalizer item wipes an executor
object , by setting it to be nil.
So, next time you may send #finalizeValues to finalizer item, it will
send #finalize to nil,
which is no-op.
Thus there is no chance that same object will be finalized twice.
See WeakFinalizerItem>>finalizeValues

>
> Levente
>
>>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: Finalization tests failing

Levente Uzonyi-2
On Sun, 31 Oct 2010, Igor Stasenko wrote:

> On 31 October 2010 18:34, Levente Uzonyi <[hidden email]> wrote:

snip

>>
>> There will be another problem with the current implementation of the new
>> finalization scheme. Since the new WeakRegistry doesn't remove the
>> associations from the dictionary, the installed finalizer (#finalizeValues)
>> will be evaluated with the already finalized WeakFinalizerItems. This may
>> cause early finalization or raise an error. The easiest way to avoid this is
>> to use a better finalizer which does nothing if the VM supports the new
>> finalization scheme.
>>
> No, that's actually not a problem. A finalizer item wipes an executor
> object , by setting it to be nil.
> So, next time you may send #finalizeValues to finalizer item, it will
> send #finalize to nil,
> which is no-op.
> Thus there is no chance that same object will be finalized twice.
> See WeakFinalizerItem>>finalizeValues

Sorry, I forgot that Object implements #finalize, so it's fine. There's a
possible concurrency issue though, but it won't cause any problem, because
two consecutive assignments are atomic.

There's still an issue with the old finalization scheme, the original
version has to be restored.


Levente

>
>>
>> Levente
>>
>>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
>