Skip to content

bpo-39010: Ignore error on cancelled future after end of loop. #20525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

cmeyer
Copy link

@cmeyer cmeyer commented May 30, 2020

Python 3.8+ outputs spurious error messages for any asyncio.run_forever call with pending run_in_executor calls when it finishes. When used in a loop that single steps through asyncio using loop.stop() followed by loop.run_forever(), there are repeated, useless error messages. The spurious error messages cannot be prevented in any way I can find.

This patch prevents these spurious error messages. The proactor and windows event code probably needs broader improvements to manage its state properly at exit. This patch does not deal with the broader issue. This patch is only a stop-gap to make Python 3.8 usable by our users.

The bug is easily reproduced with the following code (Windows only). I could not make a test case which would fail on the error since the exception is handled (and output) in low level code.

import asyncio
loop = asyncio.get_event_loop()
f = loop.run_in_executor(None, lambda: None)
loop.stop()
loop.run_forever()
loop.stop()
loop.run_forever()
loop.stop()
loop.run_forever()

https://bugs.python.org/issue39010

@cmeyer cmeyer requested review from 1st1 and asvetlov as code owners May 30, 2020 00:41
@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@cmeyer

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@bdarnell
Copy link
Contributor

bdarnell commented Sep 1, 2020

This PR is obsolete now that #22017 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants