Does it it actually crash (segfault) or are you merely getting an exception? I'm just getting bunch of exception:
Traceback (most recent call last):
File "multiprocessing_crash.py", line 155, in <module>
test_manyForkedProcessesSingleThreaded(inst1, inst2, nRuns, nProcesses)
File "multiprocessing_crash.py", line 76, in test_manyForkedProcessesSingleThreaded
run(inst1, nRuns)
File "multiprocessing_crash.py", line 28, in run
inst.run()
File "multiprocessing_crash.py", line 23, in run
self.d[self.key] = 0
File "<string>", line 2, in __setitem__
Traceback (most recent call last):
File "/usr/lib64/python2.7/multiprocessing/managers.py", line 759, in _callmethod
File "multiprocessing_crash.py", line 155, in <module>
test_manyForkedProcessesSingleThreaded(inst1, inst2, nRuns, nProcesses)
File "multiprocessing_crash.py", line 82, in test_manyForkedProcessesSingleThreaded
run(inst2, nRuns)
File "multiprocessing_crash.py", line 28, in run
inst.run()
File "multiprocessing_crash.py", line 19, in run
item = self.d.get(self.key)
File "<string>", line 2, in get
File "/usr/lib64/python2.7/multiprocessing/managers.py", line 759, in _callmethod
kind, result = conn.recv()
kind, result = conn.recv()
cPickle.UnpicklingErrorMemoryError
: invalid load key, '#'.
Traceback (most recent call last):
File "/usr/lib64/python2.7/multiprocessing/util.py", line 268, in _run_finalizers
Traceback (most recent call last):
File "/usr/lib64/python2.7/multiprocessing/util.py", line 268, in _run_finalizers
finalizer()
finalizer()
File "/usr/lib64/python2.7/multiprocessing/util.py", line 201, in __call__
File "/usr/lib64/python2.7/multiprocessing/util.py", line 201, in __call__
res = self._callback(*self._args, **self._kwargs)
res = self._callback(*self._args, **self._kwargs)
File "/usr/lib64/python2.7/multiprocessing/managers.py", line 609, in _finalize_manager
File "/usr/lib64/python2.7/multiprocessing/managers.py", line 609, in _finalize_manager
if process.is_alive():
if process.is_alive():
File "/usr/lib64/python2.7/multiprocessing/process.py", line 155, in is_alive
File "/usr/lib64/python2.7/multiprocessing/process.py", line 155, in is_alive
assert self._parent_pid == os.getpid(), 'can only test a child process'
AssertionError: can only test a child process
|
You are right, it does not segfault (sorry for the abuse of language). It raises an exception while accessing the shared dictionary. The exception varies but typically is:
Traceback (most recent call last):
File "multiprocessbug.py", line 156, in <module>
test_manyForkedProcessesSingleThreaded(inst1, inst2, nRuns, nProcesses)
File "multiprocessbug.py", line 77, in test_manyForkedProcessesSingleThreaded
run(inst1, nRuns)
File "multiprocessbug.py", line 29, in run
inst.run()
File "multiprocessbug.py", line 18, in run
if (self.d.has_key(self.key)):
File "<string>", line 2, in has_key
File "/usr/local/lib/python2.7/multiprocessing/managers.py", line 759, in _callmethod
kind, result = conn.recv()
cPickle.UnpicklingError: invalid load key, '#'.
|
This is probably a bug that was fixed sometime in Python 3x.
Testing on 3.7.1, Python gracefully errors out:
```
➜ cpython git:(bpo-32485) ✗ python issue_32485.py
Same manager, same mux
Starting test_sameProcessSameThread
Traceback (most recent call last):
File "issue_32485.py", line 130, in <module>
test_sameProcessSameThread(inst1, inst2, nRuns)
File "issue_32485.py", line 48, in test_sameProcessSameThread
run(inst1, nRuns)
File "issue_32485.py", line 30, in run
inst.run()
File "issue_32485.py", line 19, in run
if (self.d.has_key(self.key)):
File "<string>", line 2, in has_key
File "/home/gus/.pyenv/versions/3.7.1/lib/python3.7/multiprocessing/managers.py", line 811, in _callmethod
raise convert_to_error(kind, result)
multiprocessing.managers.RemoteError:
---------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gus/.pyenv/versions/3.7.1/lib/python3.7/multiprocessing/managers.py", line 251, in serve_client
function = getattr(obj, methodname)
AttributeError: 'dict' object has no attribute 'has_key'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/gus/.pyenv/versions/3.7.1/lib/python3.7/multiprocessing/managers.py", line 271, in serve_client
fallback_func = self.fallback_mapping[methodname]
KeyError: 'has_key'
---------------------------------------------------------------------------
```
|