-
Notifications
You must be signed in to change notification settings - Fork 6k
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] Suppress harmless ObjectRefStreamEndOfStreamError when using asyncio #37062
Merged
stephanie-wang
merged 4 commits into
ray-project:master
from
stephanie-wang:asyncio-stream-error
Jul 6, 2023
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will suppress any form of unexpected exception. I would suggest to explicitly wrap the ref in a task instead and ignore the specific exception type:
asyncio.wait
does this under the hood anyways so there shouldn't be additional overheadThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm actually I don't think we should do this. This part of the code is only meant to wait for the ref to become ready; we just don't have a way to do this for asyncio right now without also fetching the data.
The expected use case is that the user will then do something with the returned ref once it's ready. I believe Ray also warns if the ref has an exception and is never read, so we'll be warning twice if we don't suppress the asyncio error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see so this could raise other exceptions aside from
ObjectRefStreamEndOfStreamError
?Ideally we would "whitelist" the expected exceptions here -- maybe a conservative way to do it would be
except RayError
? I'm just a little uneasy about suppressing all exceptions, there may be some corner case that raises an unexpected exception and identifying/debugging it will be much easier if the exception is logged.Ultimately up to you though, if you don't think this is an issue then suppressing them all is fine. Though it's probably still slightly less hacky to wrap it in a task and catch bare
Exception
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, to clarify, the reasoning for suppressing all errors is that at this point, the user hasn't actually tried to receive the error yet. This function is supposed to return the
ObjectRef
that the user can await, and then at point, asyncio will warn if the user doesn't retrieve the exception.So either we don't suppress the error here, and the user will always see an extra warning, or we do suppress the error here, and then asyncio or Ray will warn if the user doesn't do anything with the ObjectRef.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Thanks for clarifying.