saltstack / saltstack/salt

[Bug]: Ctrl+C throws stacktrace on state.event

Open
#70,176 0 comments 0 reactions 1 assignee View on GitHub

@twangboy is already working on this.

Since Aug 28, 2026.

bug
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

What happened?

running salt-run state.event pretty=True throws a stacktrace when you hit Ctrl+C.

Exception occurred in runner state.event: Traceback (most recent call last):
  File "/home/shane/src/salt/salt/utils/asynchronous.py", line 245, in wrap
    asyncio.get_running_loop()
RuntimeError: no running event loop

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/shane/src/salt/salt/client/mixins.py", line 387, in low
    data["return"] = func(*args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/loader/lazy.py", line 177, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/loader/lazy.py", line 1480, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/loader/lazy.py", line 1495, in _run_as
    ret = _func_or_method(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/runners/state.py", line 442, in event
    return statemod["state.event"](
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/loader/lazy.py", line 177, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/loader/lazy.py", line 1480, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/loader/lazy.py", line 1495, in _run_as
    ret = _func_or_method(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/modules/state.py", line 2889, in event
    ret = sevent.get_event(full=True, auto_reconnect=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/utils/event.py", line 837, in get_event
    ret = self._get_event(wait, tag, match_func, no_block)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/utils/event.py", line 725, in _get_event
    raw = self.subscriber.recv(timeout=wait)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/utils/asynchronous.py", line 252, in wrap
    return self.io_loop.run_sync(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/venv_3008.x/lib/python3.11/site-packages/tornado/ioloop.py", line 536, in run_sync
    self.start()
  File "/home/shane/src/venv_3008.x/lib/python3.11/site-packages/tornado/platform/asyncio.py", line 211, in start
    self.asyncio_loop.run_forever()
  File "/home/shane/.pyenv/versions/3.11.14/lib/python3.11/asyncio/base_events.py", line 608, in run_forever
    self._run_once()
  File "/home/shane/.pyenv/versions/3.11.14/lib/python3.11/asyncio/base_events.py", line 1898, in _run_once
    event_list = self._selector.select(timeout)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/.pyenv/versions/3.11.14/lib/python3.11/selectors.py", line 468, in select
    fd_event_list = self._selector.poll(timeout, max_ev)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shane/src/salt/salt/scripts.py", line 77, in _handle_signals
    sys.exit(salt.defaults.exitcodes.EX_OK)
SystemExit: 0
Type of salt install

Official deb

Major version

3008.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

ubuntu-24.04

salt --versions-report output
head of 3008.x branch (3008.2+393.g4ae4bf944f)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.