question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Event loop is closed' while calling status from API more that once

See original GitHub issue

How to reproduce:

from packit.config import Config
from packit.cli.utils import get_packit_api
from packit.local_project import LocalProject
from packit.utils import get_repo

packit_onboarded_projects = ['https://github.com/packit-service/packit', 'https://github.com/packit-service/ogr']

for p in packit_onboarded_projects:
    packit_cfg = Config.get_user_config()
    repo = get_repo(p)
    packit_local_project = LocalProject(repo)

    packit_api = get_packit_api(config=packit_cfg, local_project=packit_local_project)
    packit_api.status()

Expected output: Status is printed for both packit and ogr

Actual output:

'upstream_project_name' configuration key was renamed to 'upstream_package_name', please update your configuration file
'upstream_project_name' configuration key was renamed to 'upstream_package_name', please update your configuration file
Traceback (most recent call last):
  File "/home/dhodovsk/logs/packit_status_error.py", line 14, in <module>
    packit_api.status()
  File "/home/dhodovsk/.local/lib/python3.7/site-packages/packit/api.py", line 567, in status
    self.status_get_updates(status),
  File "/usr/lib64/python3.7/asyncio/tasks.py", line 746, in gather
    fut = ensure_future(arg, loop=loop)
  File "/usr/lib64/python3.7/asyncio/tasks.py", line 608, in ensure_future
    task = loop.create_task(coro_or_future)
  File "/usr/lib64/python3.7/asyncio/base_events.py", line 398, in create_task
    self._check_closed()
  File "/usr/lib64/python3.7/asyncio/base_events.py", line 475, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
sys:1: RuntimeWarning: coroutine 'PackitAPI.status_get_updates' was never awaited
sys:1: RuntimeWarning: coroutine 'PackitAPI.status_get_builds' was never awaited
sys:1: RuntimeWarning: coroutine 'PackitAPI.status_get_up_releases' was never awaited
sys:1: RuntimeWarning: coroutine 'PackitAPI.status_get_dg_versions' was never awaited
sys:1: RuntimeWarning: coroutine 'PackitAPI.status_get_downstream_prs' was never awaited

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lachmanfrantisekcommented, Oct 18, 2019

This may be off-topic, but can someone please point me to any document to create the development setup locally? I would like to test this scenario, but I am super new to this project 😃

1reaction
lachmanfrantisekcommented, Oct 16, 2019

I don’t have a preference if it is OK to be used as in the reproduce script.

I saw it multiple times in the tests as well and since it will be used outside of the packit it will be good to have a stable API for that – I’ll create an issue.

edit: created https://github.com/packit-service/packit/issues/571

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Asyncio Event Loop is Closed" when getting loop
On Windows seems to be a problem with EventLoopPolicy, use this snippet to work around it: asyncio.set_event_loop_policy(asyncio.
Read more >
Python 3.8+ raises "RuntimeError: Event Loop is closed" on ...
I assume this is yet another strange issue with asyncio's stream.close() - it schedules the closing of the socket but it's not guaranteed...
Read more >
Event Loop — Python 3.11.1 documentation
Close the event loop. The loop must not be running when this function is called. Any pending callbacks will be discarded. This method...
Read more >
Don't Block the Event Loop (or the Worker Pool) - Node.js
If a thread is taking a long time to execute a callback (Event Loop) or a task (Worker), we call it "blocked". While...
Read more >
18.5.1. Base Event Loop — Python 3.6.1 documentation
Schedule all currently open asynchronous generator objects to close with an aclose() call. After calling this method, the event loop will issue a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found