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

NettyHttpServerTest.testErrorBeforeRead handle exception #1848

Merged
merged 2 commits into from
Sep 29, 2021

Conversation

Scottmitch
Copy link
Member

Motivation:
NettyHttpServerTest.testErrorBeforeRead has the server intentionally
write an error without first consuming the request content. The server
may close the connection before the client is done writting and if that
is the case a ClosedChannelException may be observed and fail the test.

Modifications:

  • Allow ClosedChannelException when making a request

Result:
Fixes #245

Motivation:
NettyHttpServerTest.testErrorBeforeRead has the server intentionally
write an error without first consuming the request content. The server
may close the connection before the client is done writting and if that
is the case a ClosedChannelException may be observed and fail the test.

Modifications:
- Allow ClosedChannelException when making a request

Result:
Fixes apple#245
@Scottmitch
Copy link
Member Author

build failure attributed to #1579

@Scottmitch Scottmitch merged commit a1fb483 into apple:main Sep 29, 2021
@Scottmitch Scottmitch deleted the netty_http_server_test branch September 29, 2021 03:23
Scottmitch added a commit that referenced this pull request Sep 29, 2021
Motivation:
NettyHttpServerTest.testErrorBeforeRead has the server intentionally
write an error without first consuming the request content. The server
may close the connection before the client is done writting and if that
is the case a ClosedChannelException may be observed and fail the test.

Modifications:
- Allow ClosedChannelException when making a request

Result:
Fixes #245
@Scottmitch
Copy link
Member Author

0.41 (a1fb483)

Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

Interesting observation

} catch (Throwable cause) {
// The server intentionally triggers an error when it writes, if this happens before all content is read
// the client may fail to write the request due to premature connection closure.
if (cause instanceof ExecutionException) {
Copy link
Member

Choose a reason for hiding this comment

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

Alternative approach can be to use "flushOnEnd" strategy by converting StreamingHttpRequest to an aggregated one and back. Then we don't need to worry about write failures on the client-side.
This approach also good. Either way is great to fix this test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NettyHttpServerTest.testErrorBeforeRead
4 participants