#1764: Infinite loop in exit handler
-----------------------+----------------------------------------------------
Reporter: nwellnhof | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: core | Version: trunk
Severity: medium | Resolution: fixed
Keywords: | Lang:
Patch: | Platform:
-----------------------+----------------------------------------------------
Changes (by plobsing):
* status: new => closed
* resolution: => fixed
Comment:
Replying to [comment:5 pmichaud]:
> {{{
> On Mon, Sep 06, 2010 at 12:35:58AM -0000, Parrot wrote:
> > Comment(by plobsing):
> > There are 2 primary causes for the lookup failure:
> > - the main sub does not remember that it is an outer sub
> > (SUB_FLAG_IS_OUTER is not preserved)
> > - the freeze/thaw process creates a clone of the main sub as the
> > exit_handler sub's outer_sub attribute. The clone does not have its
->ctx
> > field updated (only the original gets the update)
> >
> > On a higher level though, something smells wrong with using the outer
> > sub's ->ctx attribute for much of anything, let alone using it for
> > find_lex lookups.
>
> The ->ctx attribute on subs is a long-standing feature known as
> "autoclose". In fact, the problem is resolved if 'main' correctly
> does a capture_lex on its inner sub (as all lexical outers are
> supposed to do to their inner subs):
I'm not sure exactly what autoclose is (there are only 5 mentions of it in
the repo), but I suspect that may be what is broken when thawing from PBC.
> pmich...@plum:~/parrot/trunk$ cat x.pir
> .sub main :main
> .const 'Sub' $P0 = 'f'
> capture_lex $P0
> .local pmc a
> .lex 'a', a
> a = new ['Integer']
> a = 42
> f()
> .end
>
> .sub f :outer(main)
> .local pmc a
> a = find_lex 'a'
> say a
> .end
>
> pmich...@plum:~/parrot/trunk$ ./parrot -o x.pbc x.pir
> pmich...@plum:~/parrot/trunk$ ./parrot x.pbc
> 42
> pmich...@plum:~/parrot/trunk$
>
> With the capture_lex in place, I'd lean towards closing
> this as a non-bug.
After inserting the capture_lex, this no longer hangs. The ticket can be
closed.
> Pm
>
> }}}
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1764#comment:6>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets