Skip to content

pulpcore-content 3.101.0 doesn't start with uvloop #7213

@philfry

Description

@philfry

Version
pulp-container 2.27.0
pulp-file 1.16.0
pulp-glue 0.37.0
pulp-rpm 3.34.0
pulpcore 3.101.0
uvloop 0.22.1

Describe the bug
After upgrading pulpcore from 3.84.0 (and moving from python 3.9 to python 3.11 or python 3.12 (doesn't matter)) I found that pulpcore-content failed to start:

/usr/local/lib/pulp/lib64/python3.11/site-packages/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
  warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
pulp [None]: pulpcore.content:INFO: Using uvloop as the asyncio event loop.
[2026-01-15 08:43:04 +0000] [389909] [INFO] Starting gunicorn 23.0.0
[2026-01-15 08:43:04 +0000] [389909] [INFO] Listening at: http://[::]:24816 (389909)
[2026-01-15 08:43:04 +0000] [389909] [INFO] Using worker: aiohttp.GunicornUVLoopWebWorker
[2026-01-15 08:43:04 +0000] [389914] [INFO] Booting worker with pid: 389914
[2026-01-15 08:43:04 +0000] [389914] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/pulp/lib64/python3.11/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/pulp/lib64/python3.11/site-packages/aiohttp/worker.py", line 255, in init_process
    super().init_process()
  File "/usr/local/lib/pulp/lib64/python3.11/site-packages/aiohttp/worker.py", line 52, in init_process
    asyncio.get_event_loop().close()
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/pulp/lib64/python3.11/site-packages/uvloop/__init__.py", line 206, in get_event_loop
    raise RuntimeError(
RuntimeError: There is no current event loop in thread 'MainThread'.
[2026-01-15 08:43:04 +0000] [389914] [INFO] Worker exiting (pid: 389914)
[2026-01-15 08:43:05 +0000] [389909] [ERROR] Worker (pid:389914) exited with code 3
[2026-01-15 08:43:05 +0000] [389909] [ERROR] Shutting down: Master
[2026-01-15 08:43:05 +0000] [389909] [ERROR] Reason: Worker failed to boot.

By setting UVLOOP_ENABLED = False it still gives the warning, but at least it starts and works:

/usr/local/lib/pulp/lib64/python3.11/site-packages/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
   warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)

To Reproduce

  • create python3.11 or python3.12 venv
  • pip install pulpcore pulpcore[uvloop] pulp-file
  • set UVLOOP_ENABLED = True in settings.py
  • start pulpcore-content

Expected behavior
pulpcore-content starts without warnings or errors

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions