-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Test: Inspect chunked responses during termination #3139
Conversation
Test PASSed. |
We are missing such a test indeed, mainly because we don't seem to verify yet that streams that are still ongoing are really aborted in time. What we should strive for is that the connection is aborted, otherwise, responses that use The test case seems a bit fragile since it uses the same ActorSystem for server and client. We should change that as well, because we might want to add |
Test FAILed. Pull request validation reportFailed Test SuitesTest result for 'akka-http-core / Pr-validation / ./ executeTests'
|
Unrelated failure that will be fixed with #3145. |
PLS BUILD |
Test PASSed. |
try { | ||
val termination = serverBinding.terminate(hardDeadline = 50.millis) | ||
response.request(20) | ||
// local testing shows the stream fails long after the 50 ms deadline |
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.
So this test shows the deadline isn't actually enforced for streams like this?
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.
(I guess that might not be a big problem since the actorsystem shutdown will shut down the materializer and fail the stream anyway?)
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.
I'm banging my head against this a bit... What I'm seeing is that the GracefulTerminationStage does something after those 50ms but that does not kill the connection immediately (especially not the response stream). My hypothesis is, since the termination stage does not monitor response entity streams, it does something which will only indirectly stop the connection at some point. In any case, it does not cancel connection but complete it, which will still keep proper semantics in this case (because chunked encoding can detect truncation) but not in the below one.
akka-http-core/src/test/scala/akka/http/scaladsl/GracefulTerminationSpec.scala
Outdated
Show resolved
Hide resolved
Yes, I added a test for that and the client doesn't understand that it's over. The test is ignored for now. |
Test PASSed. |
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, I'm fine with merging, I debugged the remaining issue a bit and will create a ticket to follow up.
|
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 to have this behavior covered with a test, indeed let's follow up on #3209 in a separate PR
response.request(20) | ||
// local testing shows the stream fails long after the 50 ms deadline | ||
response.expectNext().utf8String should ===("reply2") | ||
response.expectNext().utf8String should ===("reply3") |
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.
Should we remove a couple of these as well?
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.
Done.
Test PASSed. |
Test PASSed. |
Tests that a chunked HTTP response stream fails when the server terminates.
The Akka HTTP client reacts as it should with "EntityStreamException: Entity stream truncation. The HTTP parser was receiving an entity when the underlying connection was closed unexpectedly."
#1210 (comment) made me curious how a client will see server termination on a chunked HTTP response stream.
I expect this test to be flaky, so I'm not sure if it is worth merging.
References #1210