-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Noticed in #47580
Kestrel creates a thread and sleeps for a second in its heartbeat:
When Kestrel stops there isn't a way to immediately stop the thread. Thread.Sleep
doesn't have cancellation.
We could change it to an AutoResetEvent + OneWait(interval). When Kestrel stops the event can be triggered and exit immediately.
However, one thing to consider is making the heartbeat as reliable as possible. Thread.Sleep
vs waiting on and event handle + timeout might have different behavior if the server is under heavy load.
Expected Behavior
The heartbeat thread immediately exits when Kestrel is stopped.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions