Skip to content

Conversation

@GrantDeljevic
Copy link

@GrantDeljevic GrantDeljevic commented Oct 24, 2025

Below error occurred, the _ignore_signals() handler in worker.py ran into an error, I believe caused by a recent uvloop update when it tries to call asyncio.get_event_loop() where none exists/all loops are closed.

This PR skips _ignore_signals when there is no open loop.

Traceback (most recent call last):
  File "/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/python3.10/site-packages/mlserver/parallel/worker.py", line 70, in run
    self._ignore_signals()
  File "/python3.10/site-packages/mlserver/parallel/worker.py", line 81, in _ignore_signals
    loop = asyncio.get_event_loop()
  File "/python3.10/site-packages/uvloop/__init__.py", line 206, in get_event_loop
    raise RuntimeError(
RuntimeError: There is no current event loop in thread 'MainThread'.

Refactor signal handling to avoid redundant code.
@CLAassistant
Copy link

CLAassistant commented Oct 24, 2025

CLA assistant check
All committers have signed the CLA.

@GrantDeljevic GrantDeljevic changed the title Fix Uvicorn/Asyncio runtime error in worker.py Fix Uvloop/Asyncio runtime error in worker.py Oct 24, 2025
@lc525
Copy link
Member

lc525 commented Nov 5, 2025

Hi @GrantDeljevic!

Thank you for the proposed fix, we are also aware of the issue. We're aiming to issue a patch release (1.7.2) containing the fix within the next week or so, but I want to fully support the new uvloop version rather than just applying the minimal work to stop the error.

Until then, we recommend users of custom-built MLServer images to pin uvloop to the previous version (0.21.0).

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 this pull request may close these issues.

3 participants