Skip to content

Preserve EventPublisher setproctitle across MasterPubServerChannel respawns - #70124

Open
dwoz wants to merge 2 commits into
saltstack:3007.xfrom
dwoz:dwoz/fix/masterpubserverchannel-preserve-eventpublisher-title
Open

Preserve EventPublisher setproctitle across MasterPubServerChannel respawns#70124
dwoz wants to merge 2 commits into
saltstack:3007.xfrom
dwoz:dwoz/fix/masterpubserverchannel-preserve-eventpublisher-title

Conversation

@dwoz

@dwoz dwoz commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

MasterPubServerChannel.pre_fork registers _publish_daemon with
ProcessManager.add_process using name="EventPublisher", so the
initial fork sets the process title to EventPublisher (the historical
label kept for backwards compat with operator tooling).
ProcessManager.restart_process, however, drops the name= kwarg
when respawning — so after any restart the fallback __qualname__
(MasterPubServerChannel._publish_daemon) is used instead. The same
logical process ends up with two different titles across its lifetime,
and any grep/pgrep/log-correlation monitoring keyed on EventPublisher
silently breaks the first time the daemon is restarted.

The fix sets the process title explicitly at the top of
_publish_daemon so both the initial fork and every respawn end up with
the same EventPublisher string. The name="EventPublisher" kwarg on
the add_process call is intentionally left alone so the historical
label continues to appear on initial fork too.

Sibling of #70111 (same bug pattern, different class — FileserverUpdate).

Test plan

  • New regression test at tests/pytests/unit/channel/test_server.py::test_publish_daemon_sets_eventpublisher_process_title
    patches setproctitle.setproctitle and asserts _publish_daemon
    calls it with "EventPublisher" before any other work.
  • Verified the test fails against the pre-fix salt/channel/server.py
    (AssertionError on the hasattr(server, "setproctitle") guard) and
    passes with the fix applied.
  • pre-commit run clean on all changed files.
  • Existing CI (test:full label added).

…spawns

MasterPubServerChannel.pre_fork registers _publish_daemon with
ProcessManager.add_process using name="EventPublisher", so the initial
fork sets the process title to "EventPublisher".
ProcessManager.restart_process, however, drops the name= kwarg when
respawning, so after any restart the fallback __qualname__
(MasterPubServerChannel._publish_daemon) is used instead. Operator
monitoring that greps for "EventPublisher" silently breaks after the
first respawn.

Set the process title explicitly at the top of _publish_daemon so both
the initial fork and every respawn end up with the same
"EventPublisher" title. Keep the name="EventPublisher" kwarg on the
add_process call so the historical initial-fork label continues to
appear as well.

Sibling of PR saltstack#70111 (same bug pattern for FileserverUpdate).
@dwoz
dwoz requested a review from a team as a code owner August 23, 2026 04:49
@dwoz dwoz added the test:full Run the full test suite label Aug 23, 2026
@dwoz dwoz added this to the Chlorine v3007.15 milestone Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant