-
Notifications
You must be signed in to change notification settings - Fork 253
"spawn" method doesn't work on 2.7 (under Linux) #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
can you verify it against new release? |
It still doesn't work. Now it doesn't raise anymore, but it hangs:
|
If I use faulthandler to set a process timeout, I see the following traces:
|
do you have any suggested fix? |
None. I don't use billiard (I evaluated it for Dask/distributed and decided against it) and I don't have time to get acquainted with it. That said, if the functionality doesn't work and doesn't stand a chance of being fixed, it would be reasonable to remove it so that people don't get lured :-) |
we have a plan to rewrite celeray billiard part with asyncio |
Still failing it seems. Used the OPs script. Traceback (most recent call last):
File "test_fork_exec.py", line 10, in <module>
with ctx.Pool(2) as p:
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/context.py", line 165, in Pool
context=self.get_context())
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/pool.py", line 959, in __init__
self._setup_queues()
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/pool.py", line 1328, in _setup_queues
self._inqueue = self._ctx.SimpleQueue()
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/context.py", line 150, in SimpleQueue
return SimpleQueue(ctx=self.get_context())
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/queues.py", line 377, in __init__
self._rlock = ctx.Lock()
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/context.py", line 105, in Lock
return Lock(ctx=self.get_context())
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/synchronize.py", line 182, in __init__
SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx)
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/synchronize.py", line 101, in __init__
register(self._semlock.name)
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/semaphore_tracker.py", line 72, in register
self._send('REGISTER', name)
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/semaphore_tracker.py", line 79, in _send
self.ensure_running()
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/semaphore_tracker.py", line 61, in ensure_running
spawnv_passfds(exe, args, fds_to_pass)
File "/Users/kirkhamj/Developer/PyCharmCE/billiard/billiard/compat.py", line 217, in spawnv_passfds
False, False, None)
TypeError: fork_exec() argument 4 must be tuple, not list |
On https://github.com/celery/billiard/blob/master/billiard/compat.py#L217 only |
For latest master bf04adf all tests in 2.7 - Ok. And start code sample work ok: from __future__ import absolute_import
from billiard import get_context
ctx = get_context('spawn')
def f(x):
return x*x
def test_spawn():
with ctx.Pool(2) as p:
print(p.map(f, list(range(10))))
if __name__ == '__main__':
test_spawn() |
Have tried with the Python 2.7 version and Billiard 3.5.0.4 on the OP's script and it fails as described in this comment. Had to use |
On Python 3.6.5 and Billiard 3.5.0.4, I get a different error using the OPs script. Pool process <billiard.pool.Worker object at 0x10e948320> error: AttributeError("Can't get attribute 'f' on <module '__main__' (built-in)>",)
Traceback (most recent call last):
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/pool.py", line 289, in __call__
sys.exit(self.workloop(pid=pid))
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/pool.py", line 347, in workloop
req = wait_for_job()
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/pool.py", line 447, in receive
ready, req = _receive(1.0)
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/pool.py", line 419, in _recv
return True, loads(get_payload())
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/common.py", line 107, in pickle_loads
return load(BytesIO(s))
AttributeError: Can't get attribute 'f' on <module '__main__' (built-in)>
Pool process <billiard.pool.Worker object at 0x100f2a390> error: AttributeError("Can't get attribute 'f' on <module '__main__' (built-in)>",)
Traceback (most recent call last):
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/pool.py", line 289, in __call__
sys.exit(self.workloop(pid=pid))
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/pool.py", line 347, in workloop
req = wait_for_job()
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/pool.py", line 447, in receive
ready, req = _receive(1.0)
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/pool.py", line 419, in _recv
return True, loads(get_payload())
File "/zopt/conda3/envs/billiard3/lib/python3.6/site-packages/billiard/common.py", line 107, in pickle_loads
return load(BytesIO(s))
AttributeError: Can't get attribute 'f' on <module '__main__' (built-in)>
Process 'SpawnPoolWorker-2' pid:48250 exited with 'exitcode 1'
Process 'SpawnPoolWorker-1' pid:48249 exited with 'exitcode 1' It seems to create new spawn pool workers that fail the same way. This continues until the 5th worker is launched and hangs. Though it is at least responsive to |
The following simple script:
fails with:
The text was updated successfully, but these errors were encountered: