Bug 257212 - net-im/prosody: Fails to start under RC, does not create pidfile
Summary: net-im/prosody: Fails to start under RC, does not create pidfile
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Li-Wen Hsu
Depends on:
Reported: 2021-07-15 19:48 UTC by phryk-ports
Modified: 2021-08-03 18:26 UTC (History)
2 users (show)

See Also:
thomas: maintainer-feedback+

make having a pidfile optional (1.20 KB, patch)
2021-07-25 13:25 UTC, Thomas Morper
thomas: maintainer-approval-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description phryk-ports 2021-07-15 19:48:32 UTC
Doing `service prosody start` will start prosody, but not create the PIDfile the rc script expects.

This leads to `service prosody status´ claiming the service isn't running when it actually is and keeps `service prosody stop` from ever working, meaning it has to be stopped by manually using `kill` on it.
Comment 1 Thomas Morper 2021-07-15 22:50:06 UTC
Yes, that's why the pkg-message says:

»Make sure your prosody.cfg.lua contains the following line
or else the init script won't work:

pidfile = "/var/run/prosody/prosody.pid"«

The "posix" module gets loaded automatically, but there's no default for the pidfile, even though you usually want one (e.g. for prosodyctl). Having this hint in the package message seemed like a reasonable approach.
Comment 2 phryk-ports 2021-07-16 16:12:22 UTC
(In reply to Thomas Morper from comment #1)
Oh, oooh. Yes, that fixes it. ^^;

Adding the pidfile definition to the beginning of `prosody.cfg.lua.sample` with a comment stating that it's needed for the rc script to work properly would probably be a good "fix" keeping the problem from even occuring in most cases. :)
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-17 03:16:28 UTC
Where possible, the default state of a ports rc scripts (and default configs) should provide for a 'working' startup out of the box. If it's possible to improve existing rc.d scripts or configuration files to provide more default settings(such as pidfile in this case), we should look to do that. What is possible to improve in this case?
Comment 4 Thomas Morper 2021-07-25 13:24:12 UTC
Its too rainy for cycling today so I had a look at this.

I think historically we either required the pidfile or I simply picked the easy way because I couldn't figure out how to make it work with procname, command_args and command_interpreter initially.

Nevertheless, since "prosodyctl" has been deprecated for startup and we no longer use that, there's no need for a pidfile any more. I've modified the rc-script to still support a user-defined pidfile, but it's neither encouraged nor required.
Comment 5 Thomas Morper 2021-07-25 13:25:15 UTC
Created attachment 226680 [details]
make having a pidfile optional

net-im/prosody: make having a pidfile optional

* Having the "pidfile" option in prosody.cfg.lua
  is no longer required by rc.d/prosody


  * portlint: OK (1 warning regarding the use of /var/db)
  * testport: OK (poudriere: 11.4 & 12.2, i386 & amd64;
                  13.0, amd64 & arm64)
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2021-07-26 02:45:58 UTC
(In reply to Thomas Morper from comment #5)

If there's no functionality/behaviour change in this and the quarterly version of the port is affected, please set merge-quarterly (to ?) so the change can be merged

Thanks Thomas!
Comment 7 Thomas Morper 2021-07-27 06:54:34 UTC
No changes in behaviour or in Prosody itself. An MFH is safe and propably a good idea.
Comment 8 Thomas Morper 2021-08-03 17:40:47 UTC
Prosody 0.11.10 has been released. A PR for an update has been submitted, already including the one-line fix for pidfile issue discussed here - see bug #257595. Once the update is accepted this bug here may be closed.