Skip to content

[core] Downgrade vendored setproctitle to 1.2.3#60185

Merged
edoakes merged 1 commit intoray-project:masterfrom
ZacAttack:differentSetProcTitle
Jan 15, 2026
Merged

[core] Downgrade vendored setproctitle to 1.2.3#60185
edoakes merged 1 commit intoray-project:masterfrom
ZacAttack:differentSetProcTitle

Conversation

@ZacAttack
Copy link
Copy Markdown
Contributor

@ZacAttack ZacAttack commented Jan 15, 2026

Description

Problem
All versions of setproctitle after 1.2.3 seem to introduce significant expense when forking. This in turn results in very slow or crashing runs of ray jobs on macOs, particularly when spawning many jobs.

Solution
Looking at the code, it seems as if versions after 1.2.3 make quite a lot of changes on Darwin in order to make the process renames work properly with Activity monitor and other MacOs utilities. This... is not 'especially' important to Ray. So downgrading doesn't cost us too much. Though of course it would have been vastly preferable to rely on a non-vendored latest version, but latest versions seem to have this issue. So we can downgrade for now and come back later potentially.

Related issues

fixes #59663

Historic Context
#53471 vendored the dependency and made a slight logic tweak in the cython binding in setproctitle.pxi. This had the benefit of fixing the cmdline parse issue described in the PR but had the downside of upgrading the library version (which now included a set of Darwin tweaks which leads to the slowdown). After this PR, the state will be that the vendored version is now old enough to not contain the activity monitor tweaks for Darwin, as well as having the changes in setproctitle.pxi.

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

All versions of setproctitle after 1.2.3 seem to introduce significant expense when forking.  This in turn results in very slow or crashing runs of ray jobs on macOs, particularly when spawning many jobs.  Looking at the code, it seems as if versions after 1.2.3 make quite a lot of changes on Darwin in order to make the process renames work properly with Activity monitor and other MacOs utilities.  This... is not 'especially' important to Ray.  So downgrading doesn't cost us too much.  Though of course it would have been vastly preferable to rely on a non-vendored latest version, but latest versions seem to have this issue.  So we can downgrade for now and come back later potentially.

Signed-off-by: ZacAttack <zac@anyscale.com>
@ZacAttack ZacAttack marked this pull request as ready for review January 15, 2026 20:14
@ZacAttack ZacAttack requested a review from a team as a code owner January 15, 2026 20:14
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request downgrades the vendored setproctitle library to version 1.2.3 to address a performance issue on macOS. The changes correctly replace the newer, problematic macOS-specific implementation with the older, more traditional argv clobbering method. The build files and documentation are updated accordingly to reflect this downgrade. The changes are logical and well-aligned with the stated goal. I've identified a few minor issues in comments and debug messages that could be addressed to improve code quality.

@edoakes edoakes added the go add ONLY when ready to merge, run all tests label Jan 15, 2026
Copy link
Copy Markdown
Collaborator

@edoakes edoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks safe to me.

@edoakes
Copy link
Copy Markdown
Collaborator

edoakes commented Jan 15, 2026

For posterity (since I had to put the pieces together): in the original PR, one of the motivations was to avoid side effects on import. This was introduced upstream in: dvarrazzo/py-setproctitle#114.

Because we're only vendoring the C code and have our own Cython bindings, that behavior is unchanged in this patch.

Copy link
Copy Markdown
Contributor

@israbbani israbbani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we capture context of your investigation and the original user reported bug in the PR description?

@edoakes edoakes enabled auto-merge (squash) January 15, 2026 22:09
@edoakes edoakes merged commit f713e0b into ray-project:master Jan 15, 2026
6 of 7 checks passed
@myandpr
Copy link
Copy Markdown
Member

myandpr commented Jan 16, 2026

Thanks for the fix! I ran the repro script on macOS and can confirm the regression is resolved and performance is back to normal.

jeffery4011 pushed a commit to jeffery4011/ray that referenced this pull request Jan 20, 2026
**Problem**
All versions of setproctitle after 1.2.3 seem to introduce significant
expense when forking. This in turn results in very slow or crashing runs
of ray jobs on macOs, particularly when spawning many jobs.

**Solution**
Looking at the code, it seems as if versions after 1.2.3 make quite a
lot of changes on Darwin in order to make the process renames work
properly with Activity monitor and other MacOs utilities. This... is not
'especially' important to Ray. So downgrading doesn't cost us too much.
Though of course it would have been vastly preferable to rely on a
non-vendored latest version, but latest versions seem to have this
issue. So we can downgrade for now and come back later potentially.
## Related issues
fixes ray-project#59663

**Historic Context**
ray-project#53471 vendored the dependency
and made a slight logic tweak in the cython binding in setproctitle.pxi.
This had the benefit of fixing the cmdline parse issue described in the
PR but had the downside of upgrading the library version (which now
included a set of Darwin tweaks which leads to the slowdown). After this
PR, the state will be that the vendored version is now old enough to not
contain the activity monitor tweaks for Darwin, as well as having the
changes in setproctitle.pxi.

Signed-off-by: ZacAttack <zac@anyscale.com>
Signed-off-by: jeffery4011 <jefferyshen1015@gmail.com>
Sparks0219 added a commit to Sparks0219/ray that referenced this pull request Jan 21, 2026
…60185)"

This reverts commit f713e0b.

Signed-off-by: joshlee <joshlee@anyscale.com>
dayshah pushed a commit that referenced this pull request Jan 22, 2026
jinbum-kim pushed a commit to jinbum-kim/ray that referenced this pull request Jan 29, 2026
…60185)" (ray-project#60361)

Signed-off-by: joshlee <joshlee@anyscale.com>
Signed-off-by: jinbum-kim <jinbum9958@gmail.com>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Feb 1, 2026
…60185)" (ray-project#60361)

Signed-off-by: joshlee <joshlee@anyscale.com>
Signed-off-by: 400Ping <jiekaichang@apache.org>
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Feb 3, 2026
**Problem**
All versions of setproctitle after 1.2.3 seem to introduce significant
expense when forking. This in turn results in very slow or crashing runs
of ray jobs on macOs, particularly when spawning many jobs.

**Solution**
Looking at the code, it seems as if versions after 1.2.3 make quite a
lot of changes on Darwin in order to make the process renames work
properly with Activity monitor and other MacOs utilities. This... is not
'especially' important to Ray. So downgrading doesn't cost us too much.
Though of course it would have been vastly preferable to rely on a
non-vendored latest version, but latest versions seem to have this
issue. So we can downgrade for now and come back later potentially.
## Related issues
fixes ray-project#59663

**Historic Context**
ray-project#53471 vendored the dependency
and made a slight logic tweak in the cython binding in setproctitle.pxi.
This had the benefit of fixing the cmdline parse issue described in the
PR but had the downside of upgrading the library version (which now
included a set of Darwin tweaks which leads to the slowdown). After this
PR, the state will be that the vendored version is now old enough to not
contain the activity monitor tweaks for Darwin, as well as having the
changes in setproctitle.pxi.

Signed-off-by: ZacAttack <zac@anyscale.com>
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Feb 3, 2026
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
**Problem**
All versions of setproctitle after 1.2.3 seem to introduce significant
expense when forking. This in turn results in very slow or crashing runs
of ray jobs on macOs, particularly when spawning many jobs.

**Solution**
Looking at the code, it seems as if versions after 1.2.3 make quite a
lot of changes on Darwin in order to make the process renames work
properly with Activity monitor and other MacOs utilities. This... is not
'especially' important to Ray. So downgrading doesn't cost us too much.
Though of course it would have been vastly preferable to rely on a
non-vendored latest version, but latest versions seem to have this
issue. So we can downgrade for now and come back later potentially.
## Related issues
fixes ray-project#59663

**Historic Context**
ray-project#53471 vendored the dependency
and made a slight logic tweak in the cython binding in setproctitle.pxi.
This had the benefit of fixing the cmdline parse issue described in the
PR but had the downside of upgrading the library version (which now
included a set of Darwin tweaks which leads to the slowdown). After this
PR, the state will be that the vendored version is now old enough to not
contain the activity monitor tweaks for Darwin, as well as having the
changes in setproctitle.pxi.

Signed-off-by: ZacAttack <zac@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…60185)" (ray-project#60361)

Signed-off-by: joshlee <joshlee@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
**Problem**
All versions of setproctitle after 1.2.3 seem to introduce significant
expense when forking. This in turn results in very slow or crashing runs
of ray jobs on macOs, particularly when spawning many jobs.

**Solution**
Looking at the code, it seems as if versions after 1.2.3 make quite a
lot of changes on Darwin in order to make the process renames work
properly with Activity monitor and other MacOs utilities. This... is not
'especially' important to Ray. So downgrading doesn't cost us too much.
Though of course it would have been vastly preferable to rely on a
non-vendored latest version, but latest versions seem to have this
issue. So we can downgrade for now and come back later potentially.
## Related issues
fixes ray-project#59663

**Historic Context**
ray-project#53471 vendored the dependency
and made a slight logic tweak in the cython binding in setproctitle.pxi.
This had the benefit of fixing the cmdline parse issue described in the
PR but had the downside of upgrading the library version (which now
included a set of Darwin tweaks which leads to the slowdown). After this
PR, the state will be that the vendored version is now old enough to not
contain the activity monitor tweaks for Darwin, as well as having the
changes in setproctitle.pxi.

Signed-off-by: ZacAttack <zac@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
peterxcli pushed a commit to peterxcli/ray that referenced this pull request Feb 25, 2026
…60185)" (ray-project#60361)

Signed-off-by: joshlee <joshlee@anyscale.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core] The sample code runs longer and freezes the system for about a minute on an M3 Pro after version 2.48.

4 participants