Bug in Dynamic Protocols?

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

Bug in Dynamic Protocols?

Michael Fremont
I believe I've found a bug in the Debugging protocol.  If I have a
selector with a 'self halt' in it, and then delete the class, the
dynamic protocols cache still holds a reference to the deleted class.
I land up with a new ObsoleteMethod.

This happens even though I have dynamic protocols turned off!

I don't know, but it's likely the other dynamic methods have a similar problem.

Best,

Mike

Reply | Threaded
Open this post in threaded view
|

Re: Bug in Dynamic Protocols?

Damien Cassou-3
Hi Michael,

I can't reproduce the bug. I use a sq3.10-7158dev07.10.2.

1) Dynamic protocols and the Debugging protocol are activated
2) I create a Test class with a #test method containing 'self halt.
3) 'DPDebugging cache' now associates a set containing #test on the class Test.
4) If I remove the class, 'DPDebugging cache' does not contain the
pair class->set anymore.

Can you try again and tell me where your experience differs from mine?
Also, can you try with a more recent version of DynamicProtocols
and/or squeak-dev?

Thank you

2007/10/12, Michael Fremont <[hidden email]>:

> I believe I've found a bug in the Debugging protocol.  If I have a
> selector with a 'self halt' in it, and then delete the class, the
> dynamic protocols cache still holds a reference to the deleted class.
> I land up with a new ObsoleteMethod.
>
> This happens even though I have dynamic protocols turned off!
>
> I don't know, but it's likely the other dynamic methods have a similar problem.
>
> Best,
>
> Mike
>
>


--
Damien Cassou

Reply | Threaded
Open this post in threaded view
|

Re: Bug in Dynamic Protocols?

Michael Fremont
Damien,

Thanks for looking into this.

I have now downloaded the same image you're using.  I make no changes
to it whatsoever.  Doing 'SystemNavigation default obsoleteClasses'
returns an empty array.

Then I make a new class 'Test'.  I delete it by doing: 'Test
removeFromSystemUnlogged' in a workspace.
Now 'SystemNavigation default obsoleteClasses' returns (AnObsoleteTest).

Using PointerFinder I see that DPRecentlyModified's cache is holding a
reference to the deleted class.

Perhaps the problem is I'm not deleting the class through the browser?

I also noticed that turning off dynamicProtocolActivation in the
Preference Browser doesn't make a difference; and if I make a method
with 'self halt' in it, the OB shows a red flag for that method, even
though I turned off BOTH dynamicProtocolActivation AND Debugging.
Very strange.

Best regards,

Mike

On 10/14/07, Damien Cassou <[hidden email]> wrote:

> Hi Michael,
>
> I can't reproduce the bug. I use a sq3.10-7158dev07.10.2.
>
> 1) Dynamic protocols and the Debugging protocol are activated
> 2) I create a Test class with a #test method containing 'self halt.
> 3) 'DPDebugging cache' now associates a set containing #test on the class Test.
> 4) If I remove the class, 'DPDebugging cache' does not contain the
> pair class->set anymore.
>
> Can you try again and tell me where your experience differs from mine?
> Also, can you try with a more recent version of DynamicProtocols
> and/or squeak-dev?
>
> Thank you
>
> 2007/10/12, Michael Fremont <[hidden email]>:
> > I believe I've found a bug in the Debugging protocol.  If I have a
> > selector with a 'self halt' in it, and then delete the class, the
> > dynamic protocols cache still holds a reference to the deleted class.
> > I land up with a new ObsoleteMethod.
> >
> > This happens even though I have dynamic protocols turned off!
> >
> > I don't know, but it's likely the other dynamic methods have a similar problem.
> >
> > Best,
> >
> > Mike
> >
> >
>
>
> --
> Damien Cassou
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Bug in Dynamic Protocols?

Damien Cassou-3
Hi Michael

2007/10/15, Michael Fremont <[hidden email]>:
> I have now downloaded the same image you're using.  I make no changes
> to it whatsoever.  Doing 'SystemNavigation default obsoleteClasses'
> returns an empty array.
>
> Then I make a new class 'Test'.  I delete it by doing: 'Test
> removeFromSystemUnlogged' in a workspace.


How do you want DynamicProtocols to update its cache if you explicitly
say «remove this silently»? Please send #removeFromSystem instead and
DynamicProtocols will be notified.


> Now 'SystemNavigation default obsoleteClasses' returns (AnObsoleteTest).
>
> Using PointerFinder I see that DPRecentlyModified's cache is holding a
> reference to the deleted class.
>
> Perhaps the problem is I'm not deleting the class through the browser?


You can bypass the browser, but you must use the notification system.


> I also noticed that turning off dynamicProtocolActivation in the
> Preference Browser doesn't make a difference;


It depends when you deactivate them. If you deactivate them in the
begining, their cache should not be updated. If you deactivate them
after having removed the class, it doesn't change anything.

> and if I make a method
> with 'self halt' in it, the OB shows a red flag for that method, even
> though I turned off BOTH dynamicProtocolActivation AND Debugging.


The red flag is not part of the dynamicprotocols. It's a feature of
the OmniBrowser.


> Very strange.

I hope things get clearer now.

--
Damien Cassou


Reply | Threaded
Open this post in threaded view
|

Re: Bug in Dynamic Protocols?

Michael Fremont
Thanks for explaining, Damien.

I'm calling #removeFromSystemUnlogged because my program dynamically
creates, uses, and discards lots of classes; logging all this makes it
hard for me to see what really matters in the changeset.

It seems to me that asking for something not to be *logged* is not the
same as asking for side-effects like hanging onto a class that no
longer exists.

However, looking at the comment for
SystemDictionary>>forgetClass:logged:, it says: 'Note that this
doesn't do everything required to dispose of a class - to do that use
Class>>removeFromSystem.  I call >>removeFromSystemUnlogged.

I see also that in forgetClass>>logged, you must be depending on the
SystemChangeNotifier>>classRemoved:fromCategory call to be notified...
and that makes sense.

I guess my problem is that I want only *some* side-effects, and not others!

Thanks for your excellent work!

Best,

Mike

On 10/15/07, Damien Cassou <[hidden email]> wrote:

> Hi Michael
>
> 2007/10/15, Michael Fremont <[hidden email]>:
> > I have now downloaded the same image you're using.  I make no changes
> > to it whatsoever.  Doing 'SystemNavigation default obsoleteClasses'
> > returns an empty array.
> >
> > Then I make a new class 'Test'.  I delete it by doing: 'Test
> > removeFromSystemUnlogged' in a workspace.
>
>
> How do you want DynamicProtocols to update its cache if you explicitly
> say «remove this silently»? Please send #removeFromSystem instead and
> DynamicProtocols will be notified.
>
>
> > Now 'SystemNavigation default obsoleteClasses' returns (AnObsoleteTest).
> >
> > Using PointerFinder I see that DPRecentlyModified's cache is holding a
> > reference to the deleted class.
> >
> > Perhaps the problem is I'm not deleting the class through the browser?
>
>
> You can bypass the browser, but you must use the notification system.
>
>
> > I also noticed that turning off dynamicProtocolActivation in the
> > Preference Browser doesn't make a difference;
>
>
> It depends when you deactivate them. If you deactivate them in the
> begining, their cache should not be updated. If you deactivate them
> after having removed the class, it doesn't change anything.
>
> > and if I make a method
> > with 'self halt' in it, the OB shows a red flag for that method, even
> > though I turned off BOTH dynamicProtocolActivation AND Debugging.
>
>
> The red flag is not part of the dynamicprotocols. It's a feature of
> the OmniBrowser.
>
>
> > Very strange.
>
> I hope things get clearer now.
>
> --
> Damien Cassou
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Bug in Dynamic Protocols?

Damien Cassou-3
Hi Michael,

I think the word 'logged' is not the right word. When you send
#removeFromSystemUnlogged, what happens really is 'remove from system
without notifying'. You might want to try to unregister the classes
you do not want to be notified.

Bye

2007/10/16, Michael Fremont <[hidden email]>:

> Thanks for explaining, Damien.
>
> I'm calling #removeFromSystemUnlogged because my program dynamically
> creates, uses, and discards lots of classes; logging all this makes it
> hard for me to see what really matters in the changeset.
>
> It seems to me that asking for something not to be *logged* is not the
> same as asking for side-effects like hanging onto a class that no
> longer exists.
>
> However, looking at the comment for
> SystemDictionary>>forgetClass:logged:, it says: 'Note that this
> doesn't do everything required to dispose of a class - to do that use
> Class>>removeFromSystem.  I call >>removeFromSystemUnlogged.
>
> I see also that in forgetClass>>logged, you must be depending on the
> SystemChangeNotifier>>classRemoved:fromCategory call to be notified...
> and that makes sense.
>
> I guess my problem is that I want only *some* side-effects, and not others!
>
> Thanks for your excellent work!
>
> Best,
>
> Mike
>
> On 10/15/07, Damien Cassou <[hidden email]> wrote:
> > Hi Michael
> >
> > 2007/10/15, Michael Fremont <[hidden email]>:
> > > I have now downloaded the same image you're using.  I make no changes
> > > to it whatsoever.  Doing 'SystemNavigation default obsoleteClasses'
> > > returns an empty array.
> > >
> > > Then I make a new class 'Test'.  I delete it by doing: 'Test
> > > removeFromSystemUnlogged' in a workspace.
> >
> >
> > How do you want DynamicProtocols to update its cache if you explicitly
> > say «remove this silently»? Please send #removeFromSystem instead and
> > DynamicProtocols will be notified.
> >
> >
> > > Now 'SystemNavigation default obsoleteClasses' returns (AnObsoleteTest).
> > >
> > > Using PointerFinder I see that DPRecentlyModified's cache is holding a
> > > reference to the deleted class.
> > >
> > > Perhaps the problem is I'm not deleting the class through the browser?
> >
> >
> > You can bypass the browser, but you must use the notification system.
> >
> >
> > > I also noticed that turning off dynamicProtocolActivation in the
> > > Preference Browser doesn't make a difference;
> >
> >
> > It depends when you deactivate them. If you deactivate them in the
> > begining, their cache should not be updated. If you deactivate them
> > after having removed the class, it doesn't change anything.
> >
> > > and if I make a method
> > > with 'self halt' in it, the OB shows a red flag for that method, even
> > > though I turned off BOTH dynamicProtocolActivation AND Debugging.
> >
> >
> > The red flag is not part of the dynamicprotocols. It's a feature of
> > the OmniBrowser.
> >
> >
> > > Very strange.
> >
> > I hope things get clearer now.
> >
> > --
> > Damien Cassou
> >
> >
> >
> >
>
>

--
Damien Cassou