Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot shut down daemon on FreeBSD if py-setproctitle is installed #67780

Open
1 of 9 tasks
asomers opened this issue Feb 27, 2025 · 0 comments
Open
1 of 9 tasks
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@asomers
Copy link
Contributor

asomers commented Feb 27, 2025

Description
If py-setproctitle is installed, then commands like service salt_minion status or service salt_minion stop won't work on FreeBSD.

Setup
The bug affects any Salt minion running on FreeBSD, if the py-setproctitle package is also installed. It probably affects the salt master too, though I haven't tested.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior

  1. Install and configure the minion using the FreeBSD package: sysutils/py-salt .
  2. Start the minion with service salt_minion start
  3. Attempt to query its status with service salt_minion status. It will wrongly fail and report salt_minion is not running. even though the minion really is running.

Expected behavior
Should see something like this:

salt_minion is running as pid 64436

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Python Version:
        Python: 3.11.11 (main, Jan 16 2025, 13:52:49) [Clang 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a
 
Dependency Versions:
          cffi: 1.17.1
      cherrypy: Not Installed
  cryptography: 42.0.8
      dateutil: 2.9.0
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.4
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.1.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.2
     pycparser: 2.22
      pycrypto: Not Installed
  pycryptodome: 3.21.0
        pygit2: Not Installed
  python-gnupg: Not Installed
        PyYAML: 6.0.1
         PyZMQ: 25.0.2
        relenv: Not Installed
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.5
 
System Versions:
          dist: freebsd 14.2 
        locale: utf-8
       machine: amd64
       release: 14.2-AXCIENT1-p1
        system: FreeBSD
       version: FreeBSD 14.2

Additional context
FreeBSD's service command relies on knowing both a daemon's PID and its process name in order to identify the running daemon. That means the daemon must have a predictable process name. But the salt minion's process name can change, depending on whether py-setproctitle is installed or not. And there are really multiple problems here:

  1. The process title is unpredictable. It either be /usr/local/bin/python3.11 /usr/local/bin/salt-minion -c /usr/local/etc/salt --pid-file=/var/run/salt-minion.pid -d or python3.11: MultiMinionProcessManager MinionProcessManager (python3.11).
  2. When py-setproctitle is installed, the process title has too many spaces (see Remove extra space in process title #67779)
  3. FreeBSD's service command expects the process title to be the name of a file, with an optional interpreter. But MultiMinionProcessManager isn't a file. So service will print out an annoying warning like /usr/local/etc/rc.d/salt_minion: WARNING: cannot read shebang line from MultiMinionProcessManager, even when I patch Salt to fix the other problems.

Possible Solutions

I see three possible solutions:

  1. Simply disable setting the process title. It's unnecessary, IMHO.
  2. Make py-setproctitle into a mandatory dependency and fix the problem of too many spaces.
  3. On FreeBSD only, don't use -d and run the process supervised by daemon(8). That would work, but it's an awfully heavyweight solution.

My main question is, why does Salt need to change its process title? Is that really necessary?

Downstream Link
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285053

@asomers asomers added Bug broken, incorrect, or confusing behavior needs-triage labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant