Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Segfault in Python ASGI app in MacOS #1653

@phijaro

Description

@phijaro

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions