-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Fix TestServer hang with duplex streaming requests #17158
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
Fix TestServer hang with duplex streaming requests #17158
Conversation
Any chance of getting this into 3.1? |
Not for 3.1.0, it's locked down tight. It could be considered for a patch to 3.1 though. @JamesNK is there any workaround for this issue? |
Calling Response.Body.FlushAsync or Response.CompleteAsync should mitigate it. |
This comment was made automatically. If there is a problem contact [email protected]. I've triaged the above build. |
Might be able to have a middleware in the test server instance that does nothing other than flush/complete. That wouldn’t be too intrusive. Otherwise this could be a 3.1 patch. |
I've tested and this isn't enough. The response will be returned to the HttpClient, but the response stream won't close until the request stream is complete. That is because clean up will wait for the request to be completed before the response: await CompleteRequestAsync();
await CompleteResponseAsync(); I think we'll need to do this as a 3.1 patch. |
@anurse Added servicing label. Also update description with required template. |
Do you want this to go in to 3.1 directly or backport from master? The PR is targeting master but you put servicing labels on it :). If you want it to go to 3.1, retarget to |
I'd like to put it directly into 3.1 and then have it merged back to master. There is no urgency to get it into 5.0. I'll retarget. |
1611131
to
953a7f9
Compare
I want to have a chat with you offline about this one @JamesNK . |
@Tratcher helped me clear this up.
Given that, this definitely is worth submitting for patch. Reapplied the labels. |
No.
|
These were approved for 3.1.2, so updating the milestone accordingly /cc @jamshedd |
Moved to Mar as per Tactics. Will need to be explicitly approved for Feb, if required. |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Description
TestServer does not correctly execute bidirectional requests. The HttpClient from a TestServer request will hang reading the response in two situations:
This PR resolves both of these issues.
Customer Impact
Because of these issues, TestServer can't be used to host gRPC functional tests of bidirectional gRPC calls.
For gRPC functional testing customers will be forced to host an in-process Kestrel instance and call via TCP sockets. This could cause port exhaustion on some OS with a large number of tests.
Regression?
No, TestServer has never correctly supported bidirectional requests.
Risk
Low. TestServer is designed for unit tests, not production use. Note: TestServer ships in Microsoft.AspNetCore.TestHost, an out-of-sdk NuGet package: https://www.nuget.org/packages/Microsoft.AspNetCore.TestHost/