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

Every integration test ends with RuntimeError: Event loop is closed #657

Closed
sed-i opened this issue Mar 23, 2022 · 2 comments · Fixed by #658
Closed

Every integration test ends with RuntimeError: Event loop is closed #657

sed-i opened this issue Mar 23, 2022 · 2 comments · Fixed by #658

Comments

@sed-i
Copy link
Contributor

sed-i commented Mar 23, 2022

While integration tests pass and all is ok, in the logs I always see this at the end:

Exception ignored in: <coroutine object Connection._pinger.<locals>._do_ping at 0x7faed2a6d1c0>
Traceback (most recent call last):
  File "/home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/client/connection.py", line 559, in _do_ping
    await pinger_facade.Ping()
  File "/home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/client/facade.py", line 482, in wrapper
    reply = await f(*args, **kwargs)
  File "/home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/client/_client1.py", line 13627, in Ping
    reply = await self.rpc(msg)
  File "/home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/client/facade.py", line 655, in rpc
    result = await self.connection.rpc(msg, encoder=TypeEncoder)
  File "/home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/client/connection.py", line 619, in rpc
    result = await self._recv(msg['request-id'])
  File "/home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/client/connection.py", line 436, in _recv
    return await self.messages.get(request_id)
  File "/home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/utils.py", line 103, in get
    value = await self._queues[id].get()
  File "/usr/lib/python3.9/asyncio/queues.py", line 168, in get
    getter.cancel()  # Just in case getter is not done yet.
  File "/usr/lib/python3.9/asyncio/base_events.py", line 746, in call_soon
    self._check_closed()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
    RuntimeError: Event loop is closed
Task was destroyed but it is pending!
task: <Task pending name='Task-1556' coro=<Connection._pinger.<locals>._do_ping() done, defined at /home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/client/connection.py:557> wait_for=<Future cancelled> cb=[create_task_with_handler.<locals>._task_result_exp_handler(task_name='tmp', logger=<Logger juju....ion (WARNING)>)() at /home/ubuntu/tmp/loki-k8s-operator/.tox/integration/lib/python3.9/site-packages/juju/jasyncio.py:64]>
@cderici
Copy link
Contributor

cderici commented Mar 28, 2022

Yeah I noticed this as well, thought we cleaned this all up in #580, thanks for bringing it up, I'll take a closer look soon 👍

cderici added a commit to cderici/python-libjuju that referenced this issue Mar 29, 2022
Exceptions that happen when a coroutine is being destroyed are
ignored, but they cause backround noise such as "Exception ignored in
coroutine ..." exceptions etc. This change tries to propogate the
exceptions so that the asyncio base handler itself can ignore the
exception as an attempt to get rid of that exception ignored noise in
test outputs etc.

Should fix juju#657
jujubot added a commit that referenced this issue Mar 30, 2022
#658

#### Description

Exceptions that happen when a coroutine is being destroyed are
ignored, but they cause backround noise such as "Exception ignored in
coroutine ..." exceptions etc. This change tries to propogate the
exceptions so that the asyncio base handler itself can ignore the
exception as an attempt to get rid of that exception ignored noise in
test outputs etc.

Should fix #657 

#### QA Steps

No such `Exception ignored in coroutine ...` output in tests. QAing this is a little weird, because the background exception (that is ignored by the GC by design) is an intermittent one.

#### Notes & Discussion
@sed-i
Copy link
Contributor Author

sed-i commented May 27, 2022

#658 was reverted in #672.
Reopen this please?

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

Successfully merging a pull request may close this issue.

2 participants