Skip to content

Forked processes on MacOS v26 die when setting proc title #165

@iamkhav

Description

@iamkhav

Hi all,
got an issue with an interaction between this lib and the newest MacOS version.

Description

With MacOS v26 (Tahoe), forked processes die silently when setting the process title.
Example to reproduce this:

import multiprocessing
import setproctitle
import time


def print_square(num):
    print("Getting proc title")
    print(setproctitle.getproctitle())
    print("Setting proc title")
    setproctitle.setproctitle(f"hi-i-square-{num}")  # <- this is where the process quits silently
    print(f"Square: {num * num}")
    time.sleep(2)
    print("Ran successfully")


def main() -> None:
    multiprocessing.set_start_method("fork")

    import sys
    print(sys.version)
    print("Starting process")

    p1 = multiprocessing.Process(target=print_square, args=(1,))
    p2 = multiprocessing.Process(target=print_square, args=(2,))
    p3 = multiprocessing.Process(target=print_square, args=(3,))

    processes = [p1, p2, p3]
    for process in processes:
        process.start()
    for process in processes:
        process.join()


if __name__ == "__main__":
    main()

Note: Getting the proc title still works. Only setting a proc title makes things break.

Unfortunately, I don't even get a good error message to put into this issue.

Anyone got an idea what the issue could be here?

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