On Fri, Jan 20, 2012 at 2:58 AM, Jun Omae <jun6...@gmail.com> wrote: > Hi, >
:) > On Fri, Jan 20, 2012 at 00:44, Olemis Lang <ole...@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 > @@ -75,7 +75,11 @@ 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 [1]_ (if u prefer check out my patch queue @ Bitbucket [2]_ ;) 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 [1]_ 2- on top of 1 includes solution 3 to the problem i.e. infinite recursion loop [7]_ Test results : - Before applying patch 1 : [3]_ - After applying patch 1 [4]_ - After applying patch 2 on top of 1 [5]_ (<= notice that I could not run the test suite because I'm experiencing an issue with notification test case [6]_ -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 @ #trac channel irc.freenode.net ;) Feedback is welcome ;) .. [1] Patch 1 : test_default_to_self_extension (https://bitbucket.org/olemis/trac-mq/src/fa0fcf0f1c3f/tho/themeengine/t-9580-tc-infinite-recursion.diff) .. [2] Olemis' patch queue for Trac . Used to play & hack & break & ... ;) (https://bitbucket.org/olemis/trac-mq) .. [3] Test results before applying patch 1 (http://paste.pocoo.org/show/537773/) .. [4] Test results after applying patch 1 (http://paste.pocoo.org/show/537774/) .. [5] Test results after applying patch 2 on top of 1 (http://paste.pocoo.org/show/537776/) .. [6] Test failure in notification test case while running Trac test suite (http://paste.pocoo.org/show/537350/) .. [7] 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 (@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 @oddsimons #trac Follow @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@googlegroups.com. To unsubscribe from this group, send email to trac-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en.