New submission from Bas Nijholt <[email protected]>:
The following code in Python 3.7.1
```
import random
import concurrent.futures
import asyncio
executor = concurrent.futures.ProcessPoolExecutor()
ioloop = asyncio.get_event_loop()
async def func():
result = await ioloop.run_in_executor(executor, random.random)
executor.shutdown(wait=False) # bug doesn't occur when `wait=True`
task = ioloop.create_task(func())
```
prints the following error:
```
Exception in thread QueueManagerThread:
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/opt/conda/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/opt/conda/lib/python3.7/concurrent/futures/process.py", line 368, in
_queue_management_worker
thread_wakeup.clear()
File "/opt/conda/lib/python3.7/concurrent/futures/process.py", line 92, in
clear
while self._reader.poll():
File "/opt/conda/lib/python3.7/multiprocessing/connection.py", line 255, in
poll
self._check_closed()
File "/opt/conda/lib/python3.7/multiprocessing/connection.py", line 136, in
_check_closed
raise OSError("handle is closed")
OSError: handle is closed
```
I think this is related to https://bugs.python.org/issue34073 and
https://bugs.python.org/issue34075
This happens in the Adaptive package
https://adaptive.readthedocs.io/en/latest/docs.html#examples and the related
issue is https://github.com/python-adaptive/adaptive/issues/156
----------
components: asyncio
messages: 337868
nosy: asvetlov, basnijholt, yselivanov
priority: normal
severity: normal
status: open
title: OSError: handle is closed for ProcessPoolExecutor and run_in_executor
versions: Python 3.7, Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36281>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com