develooper Front page | perl.perl5.porters | Postings from August 2009

Re: [perl #66158] fork crashes on perl 5.10.0/Win32 [PATCH proposal]

From:
Vincent Pit
Date:
August 5, 2009 06:11
Subject:
Re: [perl #66158] fork crashes on perl 5.10.0/Win32 [PATCH proposal]
Message ID:
68777a70f8e58704872246f985040c2c.squirrel@ssl0.ovh.net
> So if I understand it correctly, Variable::Magic has been made to work
> under threads by making use of the thread's ptr_table, which is kept
> around after a new thread is created. However, fork() under windows is
> emulated by using the same threading mechanism that threads.pm uses
> but it doesn't keep the ptr_table around (and never has). Variable::Magic
> can't distinguish between a thread clone and a fork clone, and assumes
> that the ptr_table is always around, and thus explodes.

Yes, exactly. Variable::Magic stores coderefs in a thread local context.
When a new interpreter is cloned, it needs to relink the old pointers to
their cloned counterparts. Hence it relies on hitting the pointer table in
CLONE.

>
> The thing that puzzles me is that is doesn't explode on 5.8.x.
>

I've no idea about why it works with 5.8, nor why the pointer table is
flushed for the fork emulation but not for threads.

Vincent.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About