-
Notifications
You must be signed in to change notification settings - Fork 84
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
Deliver outbound stream errors to channels. #315
Conversation
Motivation: When we hit a stream error on an outbound frame, we don't currently distinguish between them and channel errors. This makes it impossible for anyone to tell them apart. It also makes it impossible for the multiplexer to deliver these errors into the relevant stream channels that triggered them, making it essentially certain they'll be lost. Better diagnostics would be good, so we are providing them. Modifications: - Add new StreamError type that carries a stream ID and an underlying error. - Emit this StreamError type for outbound stream errors. - Deliver this StreamError type into the relevant child channels when possible. Result: Better diagnostics for stream errors.
if let streamError = error as? NIOHTTP2Errors.StreamError, | ||
let channel = self.streams[streamError.streamID] { | ||
channel.receiveStreamError(streamError) | ||
} |
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.
Is it possible to receive a stream error for a stream we don't know about? Wondering whether we should drop stream errors for streams we aren't aware of (to avoid downstream handlers, for example, closing the channel on receiving an 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.
Yes, it is, but I don't think we should drop them. Just because the multiplexer doesn't know about them doesn't mean the error is not of interest.
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.
LGTM, just one question.
channel.receiveStreamError(streamError) | ||
} | ||
|
||
context.fireErrorCaught(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.
Do we really want to unconditionaly forward it to the next channel handler even if we deliver it to one of our child channels?
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, I think we probably do: this ensures that errors don't suddenly go missing when they were reported before.
Even though, to late to the game... 👍 Great change, thanks! |
Motivation:
When we hit a stream error on an outbound frame, we don't currently
distinguish between them and channel errors. This makes it impossible
for anyone to tell them apart. It also makes it impossible for the
multiplexer to deliver these errors into the relevant stream channels
that triggered them, making it essentially certain they'll be lost.
Better diagnostics would be good, so we are providing them.
Modifications:
error.
possible.
Result:
Better diagnostics for stream errors.