[New-bugs-announce] [issue30972] Event loop incorrectly inherited in child processes.

Elvis Pranskevichus report at bugs.python.org
Wed Jul 19 18:49:35 EDT 2017


New submission from Elvis Pranskevichus:

The attached example shows that `asyncio.get_event_loop` still returns parent process' event loop in some cases.  It appears that the fix in issue #29703 was incomplete:

PARENT PID: 21947, LOOP: <_UnixSelectorEventLoop running=True closed=False debug=False> at 0x7f0fbe7cfd68
WORKER PID: 21948, LOOP: <_UnixSelectorEventLoop running=True closed=False debug=False> at 0x7f0fbe7cfd68
concurrent.futures.process._RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib64/python3.6/concurrent/futures/process.py", line 175, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "test.py", line 13, in worker
    return loop.run_until_complete(worker_coro())
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 454, in run_until_complete
    self.run_forever()
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 408, in run_forever
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "test.py", line 25, in <module>
    loop.run_until_complete(main())
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 466, in run_until_complete
    return future.result()
  File "test.py", line 21, in main
    return await loop.run_in_executor(executor, worker)
RuntimeError: This event loop is already running

----------
components: asyncio
files: test.py
messages: 298693
nosy: Elvis.Pranskevichus, yselivanov
priority: normal
severity: normal
status: open
title: Event loop incorrectly inherited in child processes.
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file47024/test.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30972>
_______________________________________


More information about the New-bugs-announce mailing list