Skip to content
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

Task was destroyed but it is pending! #450

Open
mtelka opened this issue Mar 21, 2024 · 1 comment
Open

Task was destroyed but it is pending! #450

mtelka opened this issue Mar 21, 2024 · 1 comment

Comments

@mtelka
Copy link
Contributor

mtelka commented Mar 21, 2024

While running tests for asgiref 3.8.0 I see following unexpected lines at the end of the test report:

======================== 71 passed, 1 xfailed in 12.82s ========================
Task was destroyed but it is pending!
task: <Task pending name='Task-33' coro=<StatelessServer.application_checker() running at $(BUILD_DIR)/asgiref/server.py:136> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fffadd838e0>()]>>
Task was destroyed but it is pending!
task: <Task pending name='Task-55' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-57' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-59' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-61' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-63' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-65' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-67' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-69' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-71' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-73' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
Task was destroyed but it is pending!
task: <Task pending name='Task-75' coro=<server.<locals>.app() running at $(BUILD_DIR)/tests/test_server.py:81> wait_for=<Future cancelled>>
  py39: OK (13.70=setup[0.06]+cmd[13.65] seconds)
  congratulations :) (14.51 seconds)
@carltongibson
Copy link
Member

Yes, this is an issue with the structure of StatelessServer, such that it doesn't clean up the app tasks in the test cases.

You can see the discussion here for some more detail

It would be a good clean up if you'd like to take it on.

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

No branches or pull requests

2 participants