-
Notifications
You must be signed in to change notification settings - Fork 183
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
Server control flow should close connection on DecoderException
#2419
Conversation
final Completable exchange = requestSingle.flatMapCompletable(rawRequest -> { | ||
final Completable exchange = requestSingle.whenOnError(t -> { | ||
// If an error happened before we could start writing, we need to close the channel. | ||
nettyChannel().close(); |
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.
when we close under the hood it can be difficult for users to understand who initiated closure. Consider either:
- moving this close operation into
ErrorLoggingHttpSubscriber
after it logs the reason - adding a comment that
ErrorLoggingHttpSubscriber
will log the exception if required.
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.
Good point, I've moved closure to ErrorLoggingHttpSubscriber
lgtm after the above is addressed. |
…h the client-side (apple#2367)" (apple#2423)" This reverts commit da109dd.
6dc8078
to
dd4874b
Compare
I've reverted back server-side control flow as the first commit and applied a change of this PR as the second commit. Will use "Rebase and merge" |
Motivation: apple#2367 changed server-side control flow. After that, `connection.write` doesn't start before we received a request meta-data. As the result, all errors that happen during parsing of the meta-data do not reach `WriteStreamSubscriber` and can leave a connection in undefined state, when we logged an error but didn't clean up the channel state. Modifications: - Close the channel inside `ErrorLoggingHttpSubscriber` if it was not closed already. It covers a case when an error occurs on the `Single` of request meta-data; - Add tests to verify the expected behavior; Result: Server channel is closed when an early request error happens, client doesn't hang forever.
dd4874b
to
3e4195a
Compare
…erException` (apple#2419)"" This reverts commit de8721e.
…erException` (apple#2419)"" This reverts commit de8721e.
…erException` (apple#2419)"" This reverts commit de8721e.
Motivation:
#2367 changed server-side control flow. After that,
connection.write
doesn't start before we received a request meta-data. As the result, all errors that happen during parsing of the meta-data do not reachWriteStreamSubscriber
and can leave a connection in undefined state, when we logged an error but didn't clean up the channel state.Modifications:
Single
of request meta-data;Result:
Channel is closed when an early request error happens, client doesn't hang forever.