[issue36281] OSError: handle is closed for ProcessPoolExecutor and run_in_executor
Bas Nijholt
report at bugs.python.org
Fri Apr 10 06:58:09 EDT 2020
Bas Nijholt <basnijholt at gmail.com> added the comment:
Using `git bisect` I've discovered the commit (b713adf27a) (https://github.com/python/cpython/commit/b713adf27a) that broke the code.
I've used one script:
```test.py
import sys
sys.path.append("/Users/basnijholt/Downloads/cpython/Lib/concurrent/futures/")
from random import random
from process import ProcessPoolExecutor
import asyncio
ioloop = asyncio.get_event_loop()
async def func(ioloop, executor):
result = await ioloop.run_in_executor(executor, random)
executor.shutdown(wait=False) # bug doesn't occur when `wait=True`
if __name__ == "__main__":
executor = ProcessPoolExecutor()
task = ioloop.run_until_complete(func(ioloop, executor))
```
and `test2.py`
```
import pexpect
import sys
child = pexpect.spawn("python /Users/basnijholt/Downloads/cpython/test.py")
try:
child.expect(["OSError", "AssertionError"], timeout=1)
raise Exception
except pexpect.EOF as e:
sys.exit(0)
```
Then did
```
git checkout master
git reset --hard 9b6c60cbce # bad commit
git bisect start
git bisect bad
git bisect good ad2c2d380e # good commit
git bisect run python test2.py
```
I will see if I can fix it.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36281>
_______________________________________
More information about the Python-bugs-list
mailing list