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

We seem to be leaking coroutines on error #1078

Open
dimaqq opened this issue Jul 26, 2024 · 0 comments
Open

We seem to be leaking coroutines on error #1078

dimaqq opened this issue Jul 26, 2024 · 0 comments
Labels
area/tests Updates the tests or test infrastructure kind/bug indicates a bug in the project

Comments

@dimaqq
Copy link

dimaqq commented Jul 26, 2024

Description

These kind of back traces are often printed out in at least a couple of circumstances:

  • there's an error talking to juju (?)
  • sometimes, even when the charm integration test completes successfully
asyncio:base_events.py:1758 Task exception was never retrieved
future: <Task finished name='Task-2309' coro=<Connection.reconnect() done, defined at /home/runner/work/spark-integration-hub-k8s-operator/spark-integration-hub-k8s-operator/.tox/integration-charm/lib/python3.10/site-packages/juju/client/connection.py:779> exception=OSError(9, 'Bad file descriptor')>
Traceback (most recent call last):
  File "/home/runner/work/spark-integration-hub-k8s-operator/spark-integration-hub-k8s-operator/.tox/integration-charm/lib/python3.10/site-packages/juju/client/connection.py", line 788, in reconnect
    res = await connector(
  File "/home/runner/work/spark-integration-hub-k8s-operator/spark-integration-hub-k8s-operator/.tox/integration-charm/lib/python3.10/site-packages/juju/client/connection.py", line 868, in _connect_with_login
    await self._connect(endpoints)
  File "/home/runner/work/spark-integration-hub-k8s-operator/spark-integration-hub-k8s-operator/.tox/integration-charm/lib/python3.10/site-packages/juju/client/connection.py", line 817, in _connect
    result = await task
  File "/usr/lib/python3.10/asyncio/tasks.py", line 571, in _wait_for_one
    return f.result()  # May raise f.exception().
  File "/home/runner/work/spark-integration-hub-k8s-operator/spark-integration-hub-k8s-operator/.tox/integration-charm/lib/python3.10/site-packages/juju/client/connection.py", line 806, in _try_endpoint
    return await self._open(endpoint, cacert)
  File "/home/runner/work/spark-integration-hub-k8s-operator/spark-integration-hub-k8s-operator/.tox/integration-charm/lib/python3.10/site-packages/juju/client/connection.py", line 427, in _open
    return (await websockets.connect(
  File "/home/runner/work/spark-integration-hub-k8s-operator/spark-integration-hub-k8s-operator/.tox/integration-charm/lib/python3.10/site-packages/websockets/legacy/client.py", line 647, in __await_impl_timeout__
    return await self.__await_impl__()
  File "/home/runner/work/spark-integration-hub-k8s-operator/spark-integration-hub-k8s-operator/.tox/integration-charm/lib/python3.10/site-packages/websockets/legacy/client.py", line 651, in __await_impl__
    _transport, _protocol = await self._create_connection()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1103, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1119, in _create_connection_transport
    sock.setblocking(False)

There are two distinct problems with this:

  1. we seem to be leaking coroutines (exception was not awaited)
  2. our use of webssocket library, or the library itself messes up library internal state (bad file descriptor)

Urgency

Annoying bug in our test suite

Python-libjuju version

latest

Juju version

any latest

Reproduce / Test

run any integration test

to make sure this shows up, run an integration test with some kind of error (e.g. wrong container image name to ensure the pod and application are never ready)
@hmlanigan hmlanigan added kind/bug indicates a bug in the project area/tests Updates the tests or test infrastructure labels Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tests Updates the tests or test infrastructure kind/bug indicates a bug in the project
Projects
None yet
Development

No branches or pull requests

2 participants