Skip to content

Segfault on macOS 12.5 / setproctitle 1.3.0 #111

@ekolve

Description

@ekolve

I am getting segfaults when running gunicorn 20.1.0 and setproctitle 1.3.0. My environment is Python3.10/macOS 12.5 MacBookPro M1. To reproduce create a file named test.py with the following contents:

def app(environ, start_response):
    """Simplest possible application object"""
    data = b'Hello, World!\n'
    status = '200 OK'
    response_headers = [
        ('Content-type', 'text/plain'),
        ('Content-Length', str(len(data)))
    ]
    start_response(status, response_headers)
    return iter([data])

Install gunicorn==20.1.0 setproctitle==1.3.0. Then execute the command:

gunicorn test:app

I receive the following output:

[2022-08-03 12:12:04 -0700] [99378] [INFO] Starting gunicorn 20.1.0
[2022-08-03 12:12:04 -0700] [99378] [INFO] Listening at: http://127.0.0.1:8000 (99378)
[2022-08-03 12:12:04 -0700] [99378] [INFO] Using worker: sync
[2022-08-03 12:12:06 -0700] [99378] [WARNING] Worker with pid 99380 was terminated due to signal 11
[2022-08-03 12:12:07 -0700] [99378] [WARNING] Worker with pid 99382 was terminated due to signal 11

If I downgrade the version of setproctitle to 1.2.3, there is no segfault. I did some investigation locally to try to isolate which commit is the cause of this and I believe that c993231 is the commit where this was introduced. If I install the package using python setup.py install for that commit, the segfault occurs. If I install 87378de (commit immediately preceding it on master), the error does not occur.

I can't get the error to reproduce as a standalone script (just calling setproctittle()), so I am not clear on why the error only occurs when running with gunicorn.

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