Bug 256832 - sysutils/py-salt: presence of devel/py-setproctitle breaks rc.d script
Summary: sysutils/py-salt: presence of devel/py-setproctitle breaks rc.d script
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Kirill Ponomarev
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2021-06-25 15:52 UTC by ruben
Modified: 2023-02-16 08:54 UTC (History)
6 users (show)

See Also:
ruben: maintainer-feedback+
koobs: merge-quarterly?


Attachments
change use of command_interpreter in procname for rc.d files (2.26 KB, patch)
2021-06-26 10:09 UTC, ruben
no flags Details | Diff
Make py-setproctitle a dependency and adjust rc.d files for salt (3.69 KB, patch)
2022-02-06 12:11 UTC, ruben
no flags Details | Diff
No patch, just to obsolete the current patch (44 bytes, text/plain)
2023-02-16 08:54 UTC, ruben
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ruben 2021-06-25 15:52:46 UTC
When devel/py-setproctitle is installed as a dependency of another software, it will cause salt minion to adjust its process title from (python3.8 case)

2539 0 /usr/local/bin/python3.8 /usr/local/bin/salt-minion -c /usr/local/etc/salt -d

to

8656 0 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-minion -c /usr/local/etc/salt -d KeepAlive MultiMinionProcessManager MinionProcessManager (python3.8)

the rc.d script, using "command_interpreter", cannot assert the running state of the minion and when used together in a combination with a process pacemaker (puppet, monit etc) will cause numerous copies of the minion running.

Using "procname" instead of "command_interpreter" in the rc.d script fixes this.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-26 01:52:19 UTC
@Reporter

Could you include the relevent files contents (as attachments) before and after installing setproctitle that shows the changes in invocation lines.

Also, I can't see setproctitle as an unconditional or OPTION'al dependency for the salt port. How/where/when is setproctitle being introduced? Can you provide minimal steps to reproduce
Comment 2 ruben 2021-06-26 10:09:41 UTC
Created attachment 226058 [details]
change use of command_interpreter in procname for rc.d files

This is a proposed patch to let the rc.d files for the sysutils/py-salt port to continue to work when devel/py-setproctitle is present on the system.

the one for files/salt_proxy.in is subject to debate though as it clashes with the style of using procname to start a script. having both command_interpreter and procname doesn't work.
Comment 3 ruben 2021-06-26 10:17:37 UTC
(In reply to Kubilay Kocak from comment #1)

I see two things,

I happen to have netbox installed on the same system as the salt minion, and net-mgmt/netbox installs devel/py-setproctitle as a indirect dependency through www/py-gunicorn.

I also see setproctitle as a dependency in salt's requirement files themselves, but is apparently happy to work without it:

$ grep -rl setproctitle  work-py38/salt-3003.1/requirements/ | grep freebsd
work-py38/salt-3003.1/requirements/static/pkg/py3.6/freebsd.txt
work-py38/salt-3003.1/requirements/static/pkg/py3.8/freebsd.txt
work-py38/salt-3003.1/requirements/static/pkg/py3.5/freebsd.txt
work-py38/salt-3003.1/requirements/static/pkg/py3.7/freebsd.txt
work-py38/salt-3003.1/requirements/static/pkg/py3.9/freebsd.txt
work-py38/salt-3003.1/requirements/static/ci/py3.6/freebsd.txt
work-py38/salt-3003.1/requirements/static/ci/py3.8/freebsd.txt
work-py38/salt-3003.1/requirements/static/ci/py3.5/freebsd.txt
work-py38/salt-3003.1/requirements/static/ci/py3.7/freebsd.txt
work-py38/salt-3003.1/requirements/static/ci/py3.9/freebsd.txt

so it could be added as a run dependency too
Comment 4 ruben 2022-02-06 12:05:25 UTC
Ah this one still needs to have feedback.

$ sudo pgrep -fl salt-
28354 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
28357 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
28902 /usr/local/bin/python3.8 /usr/local/bin/salt-minion -c /usr/local/etc/salt -d
28358 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
28359 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d                                     
28360 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
28361 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
28362 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
28363 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
28364 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d28366 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
28367 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d
40979 /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d

Using command_interpreter works

$ sudo pkg install py38-setproctitle
…
$ sudo service salt_minion restart
$ sudo service salt_master restart
$ sudo pgrep -fl salt-
25572 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-minion -c /usr/local/etc/salt -d KeepAlive MultiMinionProcessManager MinionProcessManager
25900 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d ProcessManager
25906 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d ZeroMQPubServerChannel
25907 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d EventPublisher
25908 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d Maintenance
25909 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d ReqServer_ProcessManager
25910 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d MWorkerQueue
25911 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d MWorker-0
25912 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d MWorker-1
25913 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d MWorker-2
25914 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d MWorker-3
25916 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d MWorker-4
25917 python3.8: /usr/local/bin/python3.8 /usr/local/bin/salt-master -c /usr/local/etc/salt -d FileserverUpdate

Using command_interpreter no longer works as the proctitle has changed

$ sudo service salt_master status
salt_master is not running.

change command_intepreter to procname makes the rc.d logic works again.

$ sudo service salt_master status
salt_master is running as pid 25900.

As python setproctitle is in salt’s requirements mentioned earlier, I’m adding a revised patch to make it a dependency
Comment 5 ruben 2022-02-06 12:11:24 UTC
Created attachment 231577 [details]
Make py-setproctitle a dependency and adjust rc.d files for salt
Comment 6 ruben 2023-02-16 08:52:32 UTC
I need to redo this patch, as there are side effects when multiple salt components are running together. The proposed technique no longer can see the difference between minion, master, and api
Comment 7 ruben 2023-02-16 08:54:35 UTC
Created attachment 240177 [details]
No patch, just to obsolete the current patch