uqfoundation / multiprocess

better multiprocessing and multithreading in Python
http://multiprocess.rtfd.io
Other
628 stars 64 forks source link

Errors for forkserver and spawn in pypy3 #94

Open mmckerns opened 2 years ago

mmckerns commented 2 years ago

pypy3 produces several KeyError and, potentially, tries to hash a UserDict (thus throwing an error) when run with a forkserver or by spawn.

Errors are as follows:

Traceback (most recent call last):
386  File "/home/travis/build/uqfoundation/multiprocess/pypy3.6/multiprocess/semaphore_tracker.py", line 132, in main
387    cache.remove(name)
388 KeyError: b'/mp-5qo35sar'

and

Traceback (most recent call last):
426  File "<string>", line 1, in <module>
427  File "/home/travis/build/uqfoundation/multiprocess/pypy3.6/multiprocess/spawn.py", line 105, in spawn_main
428    exitcode = _main(fd)
429  File "/home/travis/build/uqfoundation/multiprocess/pypy3.6/multiprocess/spawn.py", line 115, in _main
430    self = reduction.pickle.load(from_parent)
431  File "/home/travis/virtualenv/pypy3.6-7.3.1/site-packages/dill-0.3.4-py3.6.egg/dill/_dill.py", line 313, in load
432    return Unpickler(file, ignore=ignore, **kwds).load()
433  File "/home/travis/virtualenv/pypy3.6-7.3.1/site-packages/dill-0.3.4-py3.6.egg/dill/_dill.py", line 525, in load
434    obj = StockUnpickler.load(self)
435  File "/opt/python/pypy3.6-7.3.1/lib-python/3/pickle.py", line 1070, in load
436    dispatch[key[0]](self)
437  File "/opt/python/pypy3.6-7.3.1/lib-python/3/pickle.py", line 1418, in load_reduce
438    stack[-1] = func(*args)
439 TypeError: unhashable type: 'UserDict'
mmckerns commented 2 years ago

See: https://app.travis-ci.com/github/uqfoundation/multiprocess/jobs/542302744

mmckerns commented 2 years ago

Several KeyError are thrown from the mutiprocess tests for pypy-3.6, pypy-3.7, and pypy-3.8 -- due to semaphore/resource tracking issues. However, these same KeyError are present when testing multiprocessing... so I'm going to ignore them for now.

mmckerns commented 2 years ago

The multiprocessing tests throw errors for pypy-3.8 (specifically, test_preload_resources, test_timeout, test_heap, and several others due to "too many files open"). This is also seen with multiprocess, however, by skipping the three named tests noted, the other failures ('too many files open') disappear. I'll leave this as an issue to be resolved by pypy, and skip the three noted tests for now.

mmckerns commented 2 years ago

It seems that a TypeError that hangs the tests is now thrown "infrequently". Given enough tries, the tests generate a TypeError for pypy-3.6, pypy-3.7, and pypy-3.8. However, it's not always due to a UserDict as seen above. Sometimes, the error is:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/mmckerns/src/pypy3.7-v7.3.7-osx64/site-packages/multiprocess-0.70.13.dev0-py3.7.egg/multiprocess/spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "/Users/mmckerns/src/pypy3.7-v7.3.7-osx64/site-packages/multiprocess-0.70.13.dev0-py3.7.egg/multiprocess/spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
  File "/Users/mmckerns/src/pypy3.7-v7.3.7-osx64/site-packages/dill-0.3.5.dev0-py3.7.egg/dill/_dill.py", line 332, in load
    return Unpickler(file, ignore=ignore, **kwds).load()
  File "/Users/mmckerns/src/pypy3.7-v7.3.7-osx64/site-packages/dill-0.3.5.dev0-py3.7.egg/dill/_dill.py", line 557, in load
    obj = StockUnpickler.load(self)
  File "/Users/mmckerns/src/pypy3.7-v7.3.7-osx64/lib-python/3/pickle.py", line 1101, in load
    dispatch[key[0]](self)
  File "/Users/mmckerns/src/pypy3.7-v7.3.7-osx64/lib-python/3/pickle.py", line 1449, in load_reduce
    stack[-1] = func(*args)
TypeError: weak object has gone away

I'll limit the remainder of this issue to pypy3 infrequently throwing a TypeError.

mmckerns commented 2 years ago

Note that the Traceback for both TypeError experienced are identical... except for the TypeError: message itself.