[pypy-issue] [issue1087] Race condition when calling getattr
Amaury Forgeot d Arc
tracker at bugs.pypy.org
Tue Mar 13 00:39:32 CET 2012
Amaury Forgeot d Arc <amauryfa at gmail.com> added the comment:
boomboom.py also fails for me almost every time.
It's indeed a race condition: when the first thread is executing code in
encodings/ascii.py, the second thread starts to "import encoding.ascii", finds it in
sys.modules, and returns it... even when the module is not complete.
Because the module is incomplete, it is skipped (search for "mod.getregentry" in
encodings/__init__.py), and codec lookup fails.
This is a bug in pypy: the check in sys.modules should be done only with the import lock
held. This will impose a speed penalty though...
PyPy bug tracker <tracker at bugs.pypy.org>
More information about the pypy-issue