Bug Overview
When unitd is running on MacOS with --user $USER (so the application process is owned by a user that is neither root nor nobody), using it to host a Python ASGI app that makes an HTTP request on the back end causes the application process to segfault when the request is made.
Expected Behavior
I expect the request to succeed (and I have observed that it does when I run Unit under the same circumstances on e.g. Ubuntu).
Steps to Reproduce the Bug
I've constructed a minimal Unit config and example ASGI app to illustrate the bug: macos-segfault-repro.zip
To run it:
- Replace the
applications/bugrepro/working_directory value in unit_config.json with the path where you extracted the unit-bug-repro directory from the zipfile.
- Apply the fork safety workaround:
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
- Start unitd:
sudo --preserve-env=OBJC_DISABLE_INITIALIZE_FORK_SAFETY unitd --user "$USER" --control-user "$USER"
- Configure Unit using
unit_config.json: curl -X PUT --unix-socket /opt/homebrew/var/run/unit/control.sock --data-binary @unit_config.json http://localhost/config
- Make a request to the app:
curl localhost
When I do this, curl localhost outputs <!DOCTYPE html><title>Error 503</title><p>Error 503. and I find a line like
2025/09/05 20:51:55 [alert] 49429#1063395 app process 49731 exited on signal 11
in the Unit log.
Environment Details
- Target deployment platform: local machine
- Target OS: MacOS 15.6 (I've reproduced this bug on Macs with both Intel and ARM CPUs)
- Version of this project or specific commit: 1.34.2
- Version of any relevant project languages: Python 3.12.
(These are the versions of Unit and Python installed via Homebrew).
Additional Context
No response
Bug Overview
When
unitdis running on MacOS with--user $USER(so the application process is owned by a user that is neitherrootnornobody), using it to host a Python ASGI app that makes an HTTP request on the back end causes the application process to segfault when the request is made.Expected Behavior
I expect the request to succeed (and I have observed that it does when I run Unit under the same circumstances on e.g. Ubuntu).
Steps to Reproduce the Bug
I've constructed a minimal Unit config and example ASGI app to illustrate the bug: macos-segfault-repro.zip
To run it:
applications/bugrepro/working_directoryvalue inunit_config.jsonwith the path where you extracted theunit-bug-reprodirectory from the zipfile.export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YESsudo --preserve-env=OBJC_DISABLE_INITIALIZE_FORK_SAFETY unitd --user "$USER" --control-user "$USER"unit_config.json:curl -X PUT --unix-socket /opt/homebrew/var/run/unit/control.sock --data-binary @unit_config.json http://localhost/configcurl localhostWhen I do this,
curl localhostoutputs<!DOCTYPE html><title>Error 503</title><p>Error 503.and I find a line likein the Unit log.
Environment Details
(These are the versions of Unit and Python installed via Homebrew).
Additional Context
No response