
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2017-05-30 02:14 byMiguel Grinberg, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| never-retrieved.py | Miguel Grinberg,2017-05-30 02:14 | |||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 2050 | merged | yselivanov,2017-06-09 23:07 | |
| PR 2109 | merged | yselivanov,2017-06-11 13:38 | |
| PR 2110 | merged | yselivanov,2017-06-11 13:48 | |
| Messages (7) | |||
|---|---|---|---|
| msg294732 -(view) | Author: Miguel Grinberg (Miguel Grinberg) | Date: 2017-05-30 02:14 | |
I am seeing a strange issue that occurs when a task that is awaiting an asyncio.wait_for() is cancelled. I created a simple example that I think demonstrates the issue, even though it isn't exactly how it manifests on my application.When I run the attached script never-retrieved.py I get the following error:Task exception was never retrievedfuture: <Task finished coro=<crash() done, defined at never-retrieved.py:4> exception=ZeroDivisionError('division by zero',)>Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step result = coro.send(None) File "never-retrieved.py", line 5, in crash a = 1/0ZeroDivisionError: division by zeroYou can see in the script that the future was cancelled, but the cancel() call was made after the task finished in a zero division error. I think the cancel() call should update the internal state of the future so that the "exception was never retrieved" error does not appear.My application has a more complex setup that I have been unable to reproduce with a simple example. I have a task that is waiting on asyncio.wait_for(fut, timeout), with fut subsequently waiting on a websocket server's receive function. When the websocket client closes the connection, a bunch of cancellations happen, but this future inside the wait_for call crashes before wait_for gets to call cancel() on it. Even though I need to investigate this crash, the fact is that wait_for did cancel this future, but because it already ended in an error the "never retried" error is reported anyway. | |||
| msg294733 -(view) | Author: Yury Selivanov (yselivanov)*![]() | Date: 2017-05-30 02:15 | |
Yes, this is a known problem to me, thank you for creating the issue. Will work on a fix soon. | |||
| msg295708 -(view) | Author: Yury Selivanov (yselivanov)*![]() | Date: 2017-06-11 13:49 | |
New changeset7ce1c6fb579a01bb184224a10019039fde9c8eaf by Yury Selivanov in branch 'master':bpo-30508: Don't log exceptions if Task/Future "cancel()" method called (#2050)https://github.com/python/cpython/commit/7ce1c6fb579a01bb184224a10019039fde9c8eaf | |||
| msg295709 -(view) | Author: Yury Selivanov (yselivanov)*![]() | Date: 2017-06-11 14:00 | |
New changeset176f2ebdad93f20876c08efabd364a0e6c86de14 by Yury Selivanov in branch '3.6':bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. (#2109)https://github.com/python/cpython/commit/176f2ebdad93f20876c08efabd364a0e6c86de14 | |||
| msg295711 -(view) | Author: Yury Selivanov (yselivanov)*![]() | Date: 2017-06-11 14:11 | |
New changesetd24c8287e226ac9983caf6bb826a7b53142ee31f by Yury Selivanov in branch '3.5':bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. (#2110)https://github.com/python/cpython/commit/d24c8287e226ac9983caf6bb826a7b53142ee31f | |||
| msg295712 -(view) | Author: Yury Selivanov (yselivanov)*![]() | Date: 2017-06-11 14:12 | |
Fixed. Ned, this will be included in 3.6.2, right? | |||
| msg295721 -(view) | Author: Ned Deily (ned.deily)*![]() | Date: 2017-06-11 15:42 | |
Yury, yes (3.6.2 cutoff is about 24 hours from now) | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:47 | admin | set | github: 74693 |
| 2017-06-11 15:42:01 | ned.deily | set | messages: +msg295721 |
| 2017-06-11 14:12:51 | yselivanov | set | status: open -> closed versions: + Python 3.7 nosy: +ned.deily messages: +msg295712 resolution: fixed stage: resolved |
| 2017-06-11 14:11:49 | yselivanov | set | messages: +msg295711 |
| 2017-06-11 14:00:16 | yselivanov | set | messages: +msg295709 |
| 2017-06-11 13:49:20 | yselivanov | set | messages: +msg295708 |
| 2017-06-11 13:48:42 | yselivanov | set | pull_requests: +pull_request2163 |
| 2017-06-11 13:38:11 | yselivanov | set | pull_requests: +pull_request2162 |
| 2017-06-09 23:07:57 | yselivanov | set | pull_requests: +pull_request2112 |
| 2017-05-30 02:15:28 | yselivanov | set | messages: +msg294733 |
| 2017-05-30 02:14:06 | Miguel Grinberg | create | |