develooper Front page | perl.perl5.porters | Postings from May 2003

perl 5.8.0 not concurrency safe

Thread Next
From:
Gurusamy Sarathy
Date:
May 3, 2003 11:47
Subject:
perl 5.8.0 not concurrency safe
Message ID:
200305031847.h43IlBXj027423@smtp3.ActiveState.com
It seems a bunch of globals that are neither constants nor
mutexes-that-protect-truly-global-state have snuck into perlvars.h.
This breaks concurrency safety pretty badly, so they need to get
moved into intrpvars.h.  If any of these variables need to point
to common memory, that needs to be done through a well-defined
protocol (i.e. a set of API functions that can be called on the
interpreter that needs its state changed).

Take the case of PL_threadhook, for instance.  If there are multiple
interpreters within the application (could be as simple as the
examples from perlembed.pod) and one of these interpreters does
a "use threads" which sets PL_threadhook, it affects all the other
interpreters that may be executing in different threads at a random
spot in their lifetime.  If the first interpreter is then destroyed,
it unloads threads.so, and now PL_threadhook is pointing at invalid
memory and at that point trying to destroy the other interpreters
will provoke a coredump.


Sarathy
gsar@ActiveState.com

Thread Next


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