On Fri, Jan 20, 2012 at 2:52 PM, Christian Boos <christian.b...@free.fr> wrote:
> On 1/20/2012 3:05 PM, Olemis Lang wrote:
>> On Fri, Jan 20, 2012 at 2:58 AM, Jun Omae<jun6...@gmail.com>  wrote:
>>> 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
>
> And this is an error. A component constructor is called in a
> special way, as you've found out, and it should really do pretty
> much nothing.  Example of valid use is to set a list to [], a
> hash to {}, or such.  In trunk you could even use @lazy
> (http://trac.edgewall.org/changeset/10737) to help with such
> things. So doing anything lengthy is prohibited and the same
> for "re-entering" the component machinery.
>
> This is documented:
> http://www.edgewall.org/docs/trac-trunk/html/api/trac_core.html#more-on-components
>
> Well, I could add a more specific note about the temptation to
> access the extension points from there, as apparently it's not
> implicit.
>

+1
;)

>>
>>> Solution 1.
>>> Detect and refuse accessing the extension points during initializing
>>> at `ExtensionPoint.extensions`.
>>>
>> [...]
>
> Either this, or leave things as they are.
>

Considering what's been said above I'd rather go for the former .
Better explicit than implicit
;)

>
>>
>>> Solution 2.
>>> When detecting accessing the extension points, use `component` variable
>>> instead of `component.compmgr[cls]` at `ExtensionPoint.extensions`.
>>>
>
> No, this would present a misleading list, and moreover give the
> impression that it's OK to do such things.
>

I agree
-1

>
>> 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]_
>
> A bit too complex for this corner case, no? Perhaps if that would
> have been a legit corner case, but it's not.
>

ok . thnx for the replies .
:)

--
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: RT @WANdisco How you can add #uTest to #uberSVN...
http://t.co/SCUhNd6B #fb
Follow @olemislc Reply Retweet   12:35 Jan-20
  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.

Reply via email to