Skip to content

Revert "[core] Downgrade vendored setproctitle to 1.2.3 (#60185)"#60361

Merged
dayshah merged 3 commits intoray-project:masterfrom
Sparks0219:joshlee/revert-set-proctile
Jan 22, 2026
Merged

Revert "[core] Downgrade vendored setproctitle to 1.2.3 (#60185)"#60361
dayshah merged 3 commits intoray-project:masterfrom
Sparks0219:joshlee/revert-set-proctile

Conversation

@Sparks0219
Copy link
Copy Markdown
Contributor

@Sparks0219 Sparks0219 commented Jan 21, 2026

It looks this change caused multiple mac tests to fail or become flaky:

  • test_asyncio (fail)
  • test_actor_failures (fail)
  • test_actor_cancel (flaky)
  • test_cancel (flaky)

Also potentially (unlikely since this change was mac specific) responsible for a perf regression since it's in the range of commits: f182131...1fd6d11 and nothing else seems obvious.

…60185)"

This reverts commit f713e0b.

Signed-off-by: joshlee <joshlee@anyscale.com>
@Sparks0219 Sparks0219 requested a review from a team as a code owner January 21, 2026 09:02
@Sparks0219 Sparks0219 added the go add ONLY when ready to merge, run all tests label Jan 21, 2026
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 reverts a previous downgrade of the setproctitle library and introduces macOS-specific logic to address test failures and potential performance regressions. The changes include updating the vendored version to 1.3.6, modifying the BUILD.bazel file to include macOS-specific source and header files, and updating the c.h file to use stdbool.h for boolean types in C. New files darwin_set_process_name.c and darwin_set_process_name.h are added to handle process title setting on macOS using Launch Services. The spt_setup.c and spt_status.c files are updated to integrate these macOS-specific functionalities and include minor debugging improvements and typo fixes. Overall, the changes are well-aligned with the stated goal of fixing macOS-related issues.

Comment on lines +43 to +48
if (spt_setup() < 0) {
spt_debug("failed to initialize setproctitle");
}

/* Initialize the process title */
set_ps_display(title, true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The set_ps_display function is now called unconditionally, even if spt_setup() fails. If spt_setup() returns a negative value, it indicates a failure in initialization, and set_ps_display might operate on uninitialized global variables (ps_buffer, save_argv), which could lead to undefined behavior or crashes. The original logic correctly guarded this call. It's safer to only call set_ps_display if spt_setup() is successful.

    if (spt_setup() < 0) {
        spt_debug("failed to initialize setproctitle");
        return NULL;
    }

    /* Initialize the process title */
    set_ps_display(title, true);

Comment on lines +64 to +66
if (spt_setup() < 0) {
spt_debug("failed to initialize setproctitle");
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Similar to spt_setproctitle, get_ps_display is called unconditionally after spt_setup(). While get_ps_display has internal checks to prevent crashes if ps_buffer is NULL, it will return an empty string, which might not be the desired behavior if the setup failed. It would be more robust to handle the spt_setup() failure explicitly, perhaps by returning NULL or raising a Python exception to indicate that the process title could not be retrieved.

    if (spt_setup() < 0) {
        spt_debug("failed to initialize setproctitle");
        return NULL;
    }

strncpy(namebuf, name, sizeof(namebuf) - 1);
namebuf[sizeof(namebuf) - 1] = '\0';

return (pthread_setname_np(namebuf) != 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The function darwin_pthread_setname_np returns true if pthread_setname_np fails (returns non-zero) and false if it succeeds (returns zero). This is counter-intuitive for a boolean function typically indicating success. Consider inverting the return value or renaming the function to clarify its meaning (e.g., darwin_pthread_setname_np_failed).

    return (pthread_setname_np(namebuf) == 0);

cursor[bot]

This comment was marked as outdated.

@Sparks0219
Copy link
Copy Markdown
Contributor Author

Kicked off a release test to see if it affected the ask throughput numbers at all:
https://buildkite.com/ray-project/release/builds/76479
If the tasks_per_second number is high 500s it's responsible, if it's low 400s not responsible

@ZacAttack
Copy link
Copy Markdown
Contributor

ZacAttack commented Jan 21, 2026

Doesn't look like this helped the benchmarks. Also premerge is failing.

We might be able to make this work on latest with OBJC_DISABLE_INITIALIZE_FORK_SAFETY=yes baked into the environment. If you have a build of this version on mac and can observe the crash issue, try setting that environment variable and see if we can skirt the hang.

EDIT: Doesn't seem to skirt the hang, but we should see if the env variable can deflake the tests.

@ray-gardener ray-gardener bot added the core Issues that should be addressed in Ray Core label Jan 21, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

strncpy(namebuf, name, sizeof(namebuf) - 1);
namebuf[sizeof(namebuf) - 1] = '\0';

return (pthread_setname_np(namebuf) != 0);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inverted boolean return value in pthread helper

Low Severity

darwin_pthread_setname_np returns pthread_setname_np(namebuf) != 0, which evaluates to true on failure and false on success. This inverts conventional boolean semantics where true indicates success. While the return value is currently explicitly ignored at line 170 via (void) cast, the confusing semantics could cause bugs if this function is used elsewhere in the future.

Fix in Cursor Fix in Web

@dayshah dayshah merged commit ca04c29 into ray-project:master Jan 22, 2026
6 checks passed
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
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
…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

core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants