question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server shutdown prevents large response from being sent to client during draining

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Starting application host shutdown causes a large pending response to not be gracefully sent during shutdown.

  1. Start HTTP/2 request. Request pauses for 5 seconds on server.
  2. Start server application host shutdown during pause.
  3. HTTP/2 request resumes, writes 2mb to response, and finishes.
  4. Client only receives part of the response, e.g. 180kb. Hangs while waiting for the rest.
  5. Server application eventually hits shutdown timeout and forcefully closes connection.
  6. Client gets IOException.

image

Expected Behavior

I expect the client to get the entire response.

If the client app doesn’t start application host shutdown then the client correctly gets the entire response.

image

Steps To Reproduce

Ignore gRPC in the repo and project titles. gRPC user originally reported this but I reduce the repo to basic HTTP.

https://github.com/JamesNK/GrpcShutdownTest

  1. Run server.
  2. Run client.

(optional: comment out await StartShutdownCall(logger, client); in client to see the request succeed when no shutdown is triggered)

Exceptions (if any)

No response

.NET Version

6.0.300-preview.22154.4

Anything else?

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JamesNKcommented, Mar 29, 2022

Confirmed this is a Kestrel bug.

0reactions
JamesNKcommented, Mar 29, 2022

The test app works from the browser, i.e. the browser successfully downloads the 2mb response after GOAWAY.

I think this is a HttpClient issue. Moving.

May have spoken too soon. The browser has the same problem but it downloads up to 6mb of the response. A response bigger than 6mb has the same issue.

I’ll keep investigating.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Server shutdown prevents large response from being sent ...
Starting application host shutdown causes a large pending response to not be gracefully sent during shutdown. Start HTTP/2 request. Request ...
Read more >
Graceful HTTP Connection Draining During Shutdown?
This means that connections terminate cleanly, without a TCP close unless a timeout is exceeded.
Read more >
Draining — envoy 1.28.0-dev-1c259b documentation
For instance, during server shutdown, existing requests can be discouraged and listeners set to stop accepting, to reduce the number of open connections...
Read more >
Node Shutdown
There are two ways to handle node shutdown: To temporarily stop a node and restart it later, drain the node and terminate the...
Read more >
The system has rebooted without cleanly shutting down first
When using shutdown.exe to restart a server, the shutdown process will normally allow 30 seconds to ensure each running service has time to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found