pythonfutures icon indicating copy to clipboard operation
pythonfutures copied to clipboard

[Errno 32] Broken pipe When Mapping Too Many Values

Open srkunze opened this issue 9 years ago • 6 comments

First of all, thanks for that great backport. I am using it for the xfork package to support the 2.7 branch.

Unfortunately, there is something strange happening with this futures distribution which works perfectly fine with python3.4

from concurrent.futures import ProcessPoolExecutor

def calc(n):
    with ProcessPoolExecutor() as pool:
        results = pool.map(term, range(n))
        return sum(results)

def term(x):
    return x

print(calc(5000))
/usr/bin/python2.7 calc.py
12497500
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/queues.py", line 266, in _feed
    send(obj)
IOError: [Errno 32] Broken pipe

srkunze avatar Nov 02 '15 17:11 srkunze

Did you find solution?

kadnan avatar Jul 21 '17 06:07 kadnan

@kadnan Not yet. Run short of time for now. Could you find something out?

srkunze avatar Aug 03 '17 13:08 srkunze

Process pooling is pretty broken on Python 2.7. I should add something to the docs to strongly discourage its use.

agronholm avatar Aug 03 '17 13:08 agronholm

@srkunze Out of curiosity, would you mind testing on PyPy?

agronholm avatar Aug 04 '17 11:08 agronholm

@srkunze See python/cpython@dc19c24832f, seems hard to workaround (depending on how much monkeypatchng @agronholm is wiling to accept).

dalcinl avatar Oct 03 '17 13:10 dalcinl

I can accept patches but first someone needs to explain what is going on and what must be done to fix this. I myself am short on time to delve into this.

agronholm avatar Oct 03 '17 13:10 agronholm