On Fri, Jan 20, 2012 at 2:58 AM, Jun Omae wrote:
> On Fri, Jan 20, 2012 at 00:44, Olemis Lang 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.
> 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 _ (if
u prefer check out my patch queue @ 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 ;)
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
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
..  Patch 1 : test_default_to_self_extension
..  Olemis' patch queue for Trac . Used to play & hack & break & ... ;)
..  Test results before applying patch 1
..  Test results after applying patch 1
..  Test results after applying patch 2 on top of 1
..  Test failure in notification test case while running Trac test
..  Patch 2 Skipping nested calls to __init__
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
Tweet: omg ! seems I finished d first version of d patch 4
http://t.co/ZWRrJaW7 http://t.co/cE3Q6Yfb . thnx
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 [email protected]
To unsubscribe from this group, send email to
For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en.