Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core][observability] Improve observability when the core worker fails to read data from the Raylet socket #49163

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

kevin85421
Copy link
Member

@kevin85421 kevin85421 commented Dec 9, 2024

Why are these changes needed?

If a core worker process has already established a connection with the Raylet but the Raylet process subsequently exits, the core worker process will fail to read data from the socket. However, the error code returned is ENOENT, and users will see the message "No such file or directory" which is very confusing.

This PR improves observability, allowing users to identify that the I/O error is related to the socket.

For example, comment out import logging.handlers and run a random Ray program. The runtime environment agent process will fail to import logging.handlers, causing the Raylet process to exit because it shares fate with the runtime environment agent process. See #48958 (comment) for more details.

Related issue number

Checks

  1. Comment out import logging.handlers
  2. Run python3 -c "import ray; ray.init();"
  • Without this PR
    Screenshot 2024-12-09 at 12 44 36 AM

  • With this PR
    Screenshot 2024-12-09 at 12 44 54 AM

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: kaihsun <kaihsun@anyscale.com>
@kevin85421 kevin85421 added the go add ONLY when ready to merge, run all tests label Dec 9, 2024
@kevin85421 kevin85421 marked this pull request as ready for review December 9, 2024 09:06
@@ -201,6 +201,8 @@ Status ServerConnection::ReadBuffer(
bytes_remaining -= bytes_read;
if (error.value() == EINTR) {
continue;
} else if (error.value() == ENOENT) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Two questions:

if (...) {
  continue;
}
if (...) {
  return ...;
}
// do something

Copy link
Member Author

Choose a reason for hiding this comment

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

ENOENT indicates no such entry, or not found, is NotFound a better interpretation?

image

If we use NotFound, the error message will appear as shown in the screenshot above. It feels a bit strange to me to see NotFound in the error message, as it indicates that the core worker process failed to connect to the raylet process.

Suggest to apply early return, which is suggested by clang-tidy: https://clang.llvm.org/extra/clang-tidy/checks/readability/else-after-return.html

Good to know!

Signed-off-by: kaihsun <kaihsun@anyscale.com>
@jjyao jjyao merged commit 092ceff into ray-project:master Dec 11, 2024
4 checks passed
simonsays1980 pushed a commit to simonsays1980/ray that referenced this pull request Dec 12, 2024
…s to read data from the Raylet socket (ray-project#49163)

Signed-off-by: kaihsun <kaihsun@anyscale.com>
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Dec 17, 2024
…s to read data from the Raylet socket (ray-project#49163)

Signed-off-by: kaihsun <kaihsun@anyscale.com>
Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.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.

3 participants