
gerard at ggoossen
Dec 8, 2009, 4:13 AM
Post #11 of 12
(254 views)
Permalink
|
|
Re: Win32 assertions/crashes in leftover scope checks [was: RE: Black smoke on Win32 (caused by in-place array reverse changes?)]
[In reply to]
|
|
On Wed, Dec 02, 2009 at 01:39:19AM -0800, Jan Dubois wrote: > On Mon, 16 Nov 2009, Gerard Goossen wrote: > > On Fri, Nov 13, 2009 at 02:18:51PM +0100, Gerard Goossen wrote: > > > On Fri, Nov 13, 2009 at 10:50:03AM -0000, Steve Hay wrote: > > > > [...] > > > > PROG: > > > > BEGIN { > > > > $| = 1; > > > > fork and exit; > > > > print "inner\n"; > > > > } > > > > # XXX In emulated fork(), the child will not execute anything after > > > > # the BEGIN block, due to difficulties in recreating the parse stacks > > > > # and restarting yyparse() midstream in the child. This can potentially > > > > # be overcome by treating what's after the BEGIN{} as a brand new parse. > > > > #print "outer\n" > > > > EXPECTED: > > > > inner > > > > GOT: > > > > inner > > > > A s s e r t i o n f a i l e d : P L _ s c o p e s t a c k _ i x = > > > > = 1 , f i l e p e r l . c , l i n e 5 4 3 > > > > > > This assertion failure is caused by the same problem that causes the > > > execution to stop after the BEGIN block (it more or less detects that > > > there were things left unexecuted). We could simply throw away what > > > was left of the stack, but I think it might be better to given an > > > error or a warning that execution was aborted due to limitations of > > > the emulated fork. > > > > With the attach patch, an error is given when the execution is > > "finished" after the BEGIN block. The patch is not tested, and the > > fork.t test still need to be adjusted for the new error. > > Commit adab9969 pops all remaining scopes instead of die()ing with an error. > This means no change to op/fork.t is necessary, which I find preferable, as > the current behavior is already documented (as a limitation) in perlfork.pod. Doing this should be fine, but with commit 1cb985b013ea71b82afbc114ed06f94d451f5e04 you changed it to throw them away, with a comment about "failed because some of the memory was allocated from a different pool", which I think must be wrong: when cloning the interpreter everything should be copied, including all the scopes. I suspect there is a bug in the cloning code which is only hidden by not leaving the scopes. Preventing the scopes to be cleaned only here is not a good idea, because there are other places where they are cleaned, like for example when an exit occured and the code exists using the "case 2" in the same function. Also iirc if the BEGIN block was called from inside some kind of eval execution will continue there. Gerard Goossen
|