Bug 281005 - www/py-gunicorn: have daemon(8) record main worker process in pidfile
Summary: www/py-gunicorn: have daemon(8) record main worker process in pidfile
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-23 05:07 UTC by pete
Modified: 2024-09-08 17:30 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (bofh)


Attachments
add -p to daemon to store child process pid (795 bytes, patch)
2024-08-23 05:07 UTC, pete
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pete 2024-08-23 05:07:58 UTC
Created attachment 253029 [details]
add -p to daemon to store child process pid

Currently the installed gunicorn rc.d script records the PID of the supervisor process to /var/run/gunicorn.  This is done by passing "-P" via daemon(8).  

I am proposing we also record the primary gunicorn worker process in /var/run as well, this will enable better integration with tools like newsyslog(8).  For example gunicorn accepts a SIG1 signal to the main worker process to close and reopen logfiles after rotation to the main worker as well as child process.  By also passing "-p" to daemon we can then have newsyslog get the appropriate pid to sent a SIG1 to.

Here are the docs on the signals gunicorn accepts, as there are other interesting usecases this would enable as well:
https://docs.gunicorn.org/en/stable/signals.html
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-09-08 17:30:28 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5db79829135c999165db8864f37c2d8b3ba7b4f5

commit 5db79829135c999165db8864f37c2d8b3ba7b4f5
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-09-08 16:10:51 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-09-08 17:29:11 +0000

    www/py-gunicorn: Record child process

    add -p to daemon to store child process pid

    Currently the installed gunicorn rc.d script records the PID of the
    supervisor process to /var/run/gunicorn. This is done by passing "-P"
    via daemon(8).

    Record the primary gunicorn worker process in /var/run as well, this
    will enable better integration with tools like newsyslog(8). For example
    gunicorn accepts a SIG1 signal to the main worker process to close and
    reopen logfiles after rotation to the main worker as well as child
    process. By also passing "-p" to daemon we can then have newsyslog get
    the appropriate pid
    to sent a SIG1 to.

    Here are the docs on the signals gunicorn accepts, as there are other
    interesting usecases this would enable as well:
    https://docs.gunicorn.org/en/stable/signals.html

    PR:             281005
    Reported by:    pete@nomadlogic.org

 www/py-gunicorn/Makefile          | 1 +
 www/py-gunicorn/files/gunicorn.in | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)