20 Jan 2012 15:05
Re: [Trac-dev] Create new ticket vs reopen #9418 (if necessary ;)
Olemis Lang <olemis <at> gmail.com>
2012-01-20 14:05:19 GMT
2012-01-20 14:05:19 GMT
On Fri, Jan 20, 2012 at 2:58 AM, Jun Omae <jun66j5 <at> gmail.com> wrote: > Hi, > :) > On Fri, Jan 20, 2012 at 00:44, Olemis Lang <olemis <at> gmail.com> wrote: >> I'm writing a patch containing a unit test with a simplified scenario >> illustrating the barely minimal context for this to happen . The root >> cause for infinite loop is that after r10295 instances are registered >> in ComponentManager's «pool» after calling __init__ method (#9418 >> records the whole discussion ;) > > I can reproduce the issue and understand the condition. During a > component is initializing, accessing extension points of the component > causes infinite loop. > yep > Solution 1. > Detect and refuse accessing the extension points during initializing > at `ExtensionPoint.extensions`. > [...] -1 ... as this kind of situations are used by components providing default implementations for a given interface . > > Solution 2. > When detecting accessing the extension points, use `component` variable > instead of `component.compmgr[cls]` at `ExtensionPoint.extensions`. > > diff --git a/trac/core.py b/trac/core.py > index 7c03577..13a355d 100644 > --- a/trac/core.py > +++ b/trac/core.py > <at> <at> -75,7 +75,11 <at> <at> class ExtensionPoint(property): > extension point interface. > """ > classes = ComponentMeta._registry.get(self.interface, ()) > - components = [component.compmgr[cls] for cls in classes] > + compmgr = component.compmgr > + components = [component \ > + if cls not in compmgr and isinstance(component, cls) \ > + else compmgr[cls] \ > + for cls in classes] > return [c for c in components if c] > > def __repr__(self): > as I already published the patch containing the new test case _ (if u prefer check out my patch queue <at> Bitbucket _ ;) it'd be nice if u please mention whether it pass or not . If you want to hack a little in there please let me know in private so as to grant you with commit access ;) > > Thoughts? > Solution solution 3 is available ... it allows to do things as usual by skipping silently nested calls to __init__ . It comes in the form of two patches 1- adds a test case to detect this _ 2- on top of 1 includes solution 3 to the problem i.e. infinite recursion loop _ Test results : - Before applying patch 1 : _ - After applying patch 1 _ - After applying patch 2 on top of 1 _ (<= notice that I could not run the test suite because I'm experiencing an issue with notification test case _ -Trac test runner hangs to the point I have to kill -s KILL the process- , if you have any idea so as to solve this , please fork this conversation in the ML or meet me <at> #trac channel irc.freenode.net ;) Feedback is welcome ;) ..  Patch 1 : test_default_to_self_extension (https://bitbucket.org/olemis/trac-mq/src/fa0fcf0f1c3f/tho/themeengine/t-9580-tc-infinite-recursion.diff) ..  Olemis' patch queue for Trac . Used to play & hack & break & ... ;) (https://bitbucket.org/olemis/trac-mq) ..  Test results before applying patch 1 (http://paste.pocoo.org/show/537773/) ..  Test results after applying patch 1 (http://paste.pocoo.org/show/537774/) ..  Test results after applying patch 2 on top of 1 (http://paste.pocoo.org/show/537776/) ..  Test failure in notification test case while running Trac test suite (http://paste.pocoo.org/show/537350/) ..  Patch 2 Skipping nested calls to __init__ (https://bitbucket.org/olemis/trac-mq/src/fa0fcf0f1c3f/tho/themeengine/t-9580-infinite-recursion.diff) -- Regards, Olemis Facebook => http://www.facebook.com/olemis Twitter => http://www.twitter.com/olemislc ( <at> olemislc) Blog ES => http://simelo-es.blogspot.com Blog EN => http://simelo-en.blogspot.com Quora => http://www.quora.com/olemis Youtube => http://youtube.com/user/greatsoftw Featured article : Identificando números primos con expresión regular en Perl http://feedproxy.google.com/~r/simelo-news/~3/BHr859OSndo/identificando-numeros-primos-con.html Tweet: omg ! seems I finished d first version of d patch 4 http://t.co/ZWRrJaW7 http://t.co/cE3Q6Yfb . thnx <at> oddsimons #trac Follow <at> olemislc Reply Retweet 17:24 Jan-19 Get this email app! Get a signature like this. CLICK HERE. -- -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to trac-dev <at> googlegroups.com. To unsubscribe from this group, send email to trac-dev+unsubscribe <at> googlegroups.com. For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en.