[asyncio] bpo-30423: add regression test for orphan future causes "RuntimeError: Event loop stopped before Future completed."#3295
Merged
Conversation
…ure-close-loop [Asyncio] Call remove_done_callback in finally section to prevent orphan future cause RuntimeError: Event loop stopped before Future completed.
* 'master' of https://github.com/python/cpython: (601 commits) remove check for bug last seem in Solaris 9 (python#3285) Change code owners for hashlib and ssl to the crypto team (python#3284) bpo-31281: Fix pathlib.Path incompatibility in fileinput (pythongh-3208) remove autoconf check for select() (python#3283) remove configure check for 'volatile' (python#3281) Add missing _sha3 module to Setup.dist (python#2395) bpo-12383: Also ignore __PYVENV_LAUNCHER__ (python#3278) bpo-9146: add the missing NEWS entry. (python#3275) Fix a c.f.as_completed() refleak previously introduced in bpo-27144 (python#3270) bpo-31185: Fixed miscellaneous errors in asyncio speedup module. (python#3076) remove a redundant lower in urllib.parse.urlsplit (python#3008) bpo-31323: Fix reference leak in test_ssl (python#3263) bpo-31250, test_asyncio: fix EventLoopTestsMixin.tearDown() (python#3264) bpo-31326: ProcessPoolExecutor waits for the call queue thread (python#3265) bpo-27144: concurrent.futures as_complete and map iterators do not keep reference to returned object (python#1560) bpo-31250, test_asyncio: fix dangling threads (python#3252) bpo-31217: Fix regrtest -R for small integer (python#3260) bpo-30096: Use ABC in abc reference examples (python#1220) bpo-30737: Update DevGuide links to new URL (pythonGH-3228) [Trivial] Remove now redundant assert (python#3245) ...
… "RuntimeError: Event loop stopped before Future completed."
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
1st1
reviewed
Oct 19, 2017
| loop = asyncio.new_event_loop() | ||
| asyncio.set_event_loop(loop) | ||
| try: | ||
| with mock.patch('asyncio.base_events.BaseEventLoop.run_forever', side_effect=Exception): |
Member
There was a problem hiding this comment.
Make sure that all lines are < 80 chars per PEP 8
Member
|
LGTM but please fix code style |
Contributor
|
Codestyle is fixed |
embray
pushed a commit
to embray/cpython
that referenced
this pull request
Nov 9, 2017
…ntimeError: Event loop stopped before Future completed." (python#3295) * call remove_done_callback in finally section * [asyncio] bpo-30423 bug: add regression test for orphan future causes "RuntimeError: Event loop stopped before Future completed."
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@1st1
When comment out the changes (remove future.remove_done_callback(_run_until_complete_cb) out of finally block) in run_until_complete(), this test fails.
With the committed fix, this test can pass and it work as a regression test.
ERROR: test_run_until_complete_loop_orphan_future_close_loop (test.test_asyncio.test_base_events.BaseEventLoopTests)
Traceback (most recent call last):
File "/Users/jimmylai/workspace/cpython/Lib/test/test_asyncio/test_base_events.py", line 543, in test_run_until_complete_loop_orphan_future_close_loop
loop.run_until_complete(foo(0.1))
File "/Users/jimmylai/workspace/cpython/Lib/asyncio/base_events.py", line 463, in run_until_complete
raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.
https://bugs.python.org/issue30423
Ref: #1688