libshm retry on EINTR#15964
Closed
ssnl wants to merge 2 commits into
Closed
Conversation
soumith
approved these changes
Jan 11, 2019
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
@soumith is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Collaborator
|
@ssnl a test errored out on OSX: |
Collaborator
Author
|
@soumith Fixed! |
ssnl
commented
Jan 12, 2019
| // | ||
| // All functions used in `libshm` (so far) indicate error by returning `-1`. If | ||
| // you want to use a function with a different error reporting mechanism, you | ||
| // need to port `SYSCHECK` from `torch/lib/c10d/Utils.hpp`. |
Collaborator
Author
There was a problem hiding this comment.
This refers to the modified macro in #15986
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
@soumith is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
facebook-github-bot
pushed a commit
that referenced
this pull request
Jan 15, 2019
Summary: In #15964, I learned that `errno` is only meaningful if the function call fails. E.g., on some macos, a successful `fork()` sets `errno` to `EINVAL` in child process. This commit changes the `SYSCALL` macro so error checking is only done when an error happens. This means checking whether `rv == -1` for most calls, but is checking `rv == nullptr` for `inet_ntop`. Now `SYSCALL` accepts a second argument `success_cond`, which should be an expression returning whether the call succeeded. `SYSCHECK_ERR_RETURN_NEG1` is the shorthand for checking if rv is `-1`. Any suggestion on better macro names is welcomed. Pull Request resolved: #15986 Reviewed By: janewangfb Differential Revision: D13661790 Pulled By: pietern fbshipit-source-id: 9551b14b9f88805454a7bfb8e4d39e0f3aed8131
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
Summary: fixes pytorch#14314 Pull Request resolved: pytorch#15964 Differential Revision: D13639034 Pulled By: soumith fbshipit-source-id: 44592762aa46982e5d3616d55b5666a2c2ce9105
laurentdupin
pushed a commit
to laurentdupin/pytorch
that referenced
this pull request
Apr 24, 2026
Summary: In pytorch#15964, I learned that `errno` is only meaningful if the function call fails. E.g., on some macos, a successful `fork()` sets `errno` to `EINVAL` in child process. This commit changes the `SYSCALL` macro so error checking is only done when an error happens. This means checking whether `rv == -1` for most calls, but is checking `rv == nullptr` for `inet_ntop`. Now `SYSCALL` accepts a second argument `success_cond`, which should be an expression returning whether the call succeeded. `SYSCHECK_ERR_RETURN_NEG1` is the shorthand for checking if rv is `-1`. Any suggestion on better macro names is welcomed. Pull Request resolved: pytorch#15986 Reviewed By: janewangfb Differential Revision: D13661790 Pulled By: pietern fbshipit-source-id: 9551b14b9f88805454a7bfb8e4d39e0f3aed8131
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #14314