Skip to content

Gunicorn reload with HUP stops main logging #3401

@AndyDira

Description

@AndyDira

Running Gunicorn 23.0.
Startup line like

gunicorn my_app:app -c gunicorn.conf.py -p $PIDFILE --error-logfile $LOGDIR/$(date +%Y%m%d-%s).log

In the log file after sending -HUP signal.

[2025-06-06 10:40:53 +0300] [941791] [INFO] Starting gunicorn 23.0.0
[2025-06-06 10:40:53 +0300] [941791] [INFO] Listening at: http://0.0.0.0:1234 (941791)
[2025-06-06 10:40:53 +0300] [941791] [INFO] Using worker: src.my_app.MyUvicornWorker
[2025-06-06 10:40:53 +0300] [941801] [INFO] Booting worker with pid: 941801
[2025-06-06 10:40:53 +0300] [941801] [INFO] Started server process [941801]
[2025-06-06 10:40:53 +0300] [941801] [INFO] Waiting for application startup.
[2025-06-06 10:40:53 +0300] [941801] [INFO] Application startup complete.
[2025-06-06 10:40:53 +0300] [941804] [INFO] Booting worker with pid: 941804
[2025-06-06 10:40:53 +0300] [941805] [INFO] Booting worker with pid: 941805
[2025-06-06 10:40:53 +0300] [941804] [INFO] Started server process [941804]
[2025-06-06 10:40:53 +0300] [941804] [INFO] Waiting for application startup.
[2025-06-06 10:40:53 +0300] [941804] [INFO] Application startup complete.
[2025-06-06 10:40:53 +0300] [941805] [INFO] Started server process [941805]
[2025-06-06 10:40:53 +0300] [941805] [INFO] Waiting for application startup.
[2025-06-06 10:40:53 +0300] [941805] [INFO] Application startup complete.
[2025-06-06 10:41:32 +0300] [941791] [INFO] Handling signal: hup
[2025-06-06 10:41:32 +0300] [941791] [INFO] Hang up: Master
[2025-06-06 10:41:32 +0300] [941804] [INFO] Shutting down
[2025-06-06 10:41:32 +0300] [941804] [INFO] Error while closing socket [Errno 9] Bad file descriptor
[2025-06-06 10:41:32 +0300] [941801] [INFO] Shutting down
[2025-06-06 10:41:32 +0300] [941801] [INFO] Error while closing socket [Errno 9] Bad file descriptor
[2025-06-06 10:41:32 +0300] [941805] [INFO] Shutting down
[2025-06-06 10:41:32 +0300] [941805] [INFO] Error while closing socket [Errno 9] Bad file descriptor
[2025-06-06 10:41:32 +0300] [941804] [INFO] Waiting for application shutdown.
[2025-06-06 10:41:32 +0300] [941804] [INFO] Application shutdown complete.
[2025-06-06 10:41:32 +0300] [941804] [INFO] Finished server process [941804]
[2025-06-06 10:41:32 +0300] [941801] [INFO] Waiting for application shutdown.
[2025-06-06 10:41:32 +0300] [941801] [INFO] Application shutdown complete.
[2025-06-06 10:41:32 +0300] [941801] [INFO] Finished server process [941801]
[2025-06-06 10:41:32 +0300] [941805] [INFO] Waiting for application shutdown.
[2025-06-06 10:41:32 +0300] [941805] [INFO] Application shutdown complete.
[2025-06-06 10:41:32 +0300] [941805] [INFO] Finished server process [941805]


After reload Gunicorn continues to work properly, master PID 941791 retained and received new PIDs for server processes.

Problem - no lines with

[2025-06-06 10:41:53 +0300] [New PID] [INFO] Started server process [New PID]
[2025-06-06 10:41:53 +0300] [New PID] [INFO] Waiting for application startup.
[2025-06-06 10:41:53 +0300] [New PID] [INFO] Application startup complete.

appear in the log after HUP signal was processed. No messages from new workers; they exist in OS.

Expected result - after reload with HUP messages from Gunicorn workers continue to be logged in main Gunicorn Log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions