[New-bugs-announce] [issue29309] Interpreter hang when interrupting a loop.run_in_executor() future
Romain Sébille
report at bugs.python.org
Wed Jan 18 09:58:33 EST 2017
New submission from Romain Sébille:
Hi,
I stumble on this today and can't find any reasons or previous issue as to why this happen so I thought of submitting the issue here.
I attached a script (run_in_executor.py) to reproduce the problem, the original problem arise when waiting to read on a socket but I have the same result with time.sleep().
The output:
$ python3.6 run_in_executor.py
Start
Going to sleep
^CClosing loop
Traceback (most recent call last):
File "run_in_executor.py", line 15, in <module>
loop.run_until_complete(sleep_in_executor(loop))
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 454, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 421, in run_forever
self._run_once()
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 1389, in _run_once
event_list = self._selector.select(timeout)
File "/usr/local/lib/python3.6/selectors.py", line 445, in select
fd_event_list = self._epoll.poll(timeout, max_ev)
KeyboardInterrupt
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 39, in _python_exit
t.join()
File "/usr/local/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/local/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
Current behavior:
We have to send two ^C before we go back to the shell.
Expected behavior:
Only one ^C to go back to the shell.
Python versions tested:
- Python 3.4.2
- Python 3.4.6
- Python 3.5.3
- Python 3.6.0
>From what I have gathered the error is within the ThreadPoolExecutor cleaning function but I don't see why there are still living workers, the Executor.shutdown() take care of that.
Unfortunately I don't really know what to look, is a AsyncIO bug ? A ThreadPoolExecutor bug ? Or something else.
----------
components: asyncio
files: run_in_executor.py
messages: 285732
nosy: gvanrossum, rsebille, yselivanov
priority: normal
severity: normal
status: open
title: Interpreter hang when interrupting a loop.run_in_executor() future
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file46328/run_in_executor.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29309>
_______________________________________
More information about the New-bugs-announce
mailing list