Recover Katello event daemon after forced restart

Open
#889 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start with the Katello event daemon startup logic that uses Process.kill(0, pid_from_file), then review the linked CI failures and the sosreport sequence. Done means startup ownership uses a lifetime file lock that is released after SIGKILL, while the PID file remains diagnostic and the replacement container starts the daemon again.

Written by the indexing model from the issue text.

Description

Repeated foremanctl CI runs can leave katello_events permanently reported as Not running after the Foreman container is restarted.

The failure is visible in multiple unrelated PRs, for example:

The sosreport from the first job shows the sequence clearly:

  1. foreman.service starts the Katello event daemon and writes its PID.
  2. A later restart exceeds the 10-second container stop timeout and Podman sends SIGKILL.
  3. The runtime directory persists across replacement containers, so the daemon PID file survives.
  4. The replacement Foreman container serves requests, but there is no new Katello event daemon started log entry and /api/v2/ping reports katello_events: Not running.

Katello currently considers the daemon started when Process.kill(0, pid_from_file) succeeds. A stale PID can therefore point at an unrelated process after the container is replaced and prevent the daemon from starting indefinitely.

The startup ownership should use a lifetime file lock instead. The kernel releases that lock even after SIGKILL, while the PID file can remain available for diagnostics without being the source of truth.

Dominant language
Python
Stars
26
Forks
56
Avg merge
2d 18h
Merged PRs (30d)
34

Getting set up

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.

More from theforeman/foremanctl

All issues in theforeman/foremanctl

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.