HttpContext dispose diagnostics don't get processed (not always)
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Description
When using the diagnostics, sometimes, they don't arrive.
This seems to happen because the HttpContext disposal is handing this.
The server that handled that context however, allows to shutdown.
Maybe due to GC running later there's a problem in this area.
It seems to have started with .net8
I did some tests and traces because of this PR: https://github.com/opentracing-contrib/csharp-netcore/pull/104
(The delay shouldn't be needed. The host should wait for shutting down)
Quite often the diagnostics triggers don't hit before shutdown.
Which I believe eventually comes from the framework, which is allowing a shutdown before all data regarding a request (HttpContext with disposal) is finished
@
### Reproduction Steps
https://github.com/opentracing-contrib/csharp-netcore/pull/104
It started failing from .net8
### Expected behavior
Host shouldn't shut down before processing all diagnostics
### Actual behavior
Host shuts down before processing all diagnostics
### Regression?
_No response_
### Known Workarounds
Applying a Delay
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start with the reproduction and traces linked from opentracing-contrib/csharp-netcore#104, comparing behavior before and after .NET 8. Investigate the interaction between HttpContext disposal, server shutdown, and diagnostic processing. Done means the host waits for request-related diagnostics to be processed without requiring an arbitrary delay.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100