-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Propagated headers get mixed up without previous async middleware #15384
Comments
@davidfowl related? #13991 |
Yes it’s the same bug |
@davidfowl ping |
What's the plan for 3.1? is this bug significantly important to include the fix? |
Due to this subtle bug, it is risky to use the HeaderPropagation middleware at the moment. If not possible to patch, should we document the bug somewhere (currently there is no documentation for this middleware) with some steps to take when using the middleware to avoid the bug? (e.g.: making sure this is not used as first async middleware in the pipeline) /cc @rynowak |
Agreed, we need to patch this. |
@alefranz best bet is to send a PR to |
Although I'm not entirely clear on the current state since the linked PR was to master but closed. If there's a change to be made in |
Thank you Andrew for looking into this. |
This was fixed in #18300 which will be released in 3.1.3. |
Describe the bug
When using
app.UseHeaderPropagation();
as the first middleware in the pipeline and sending many simultaneous requests, I've observed incorrect headers being propagated sometimes.When inserting any async middleware before header propagation (e.g.
app.Use(async (context, next) => await next.Invoke());
), all propagated headers are correct.To Reproduce
Steps to reproduce the behavior (ASP.NET Core 3.0 by default):
dotnet run --project MangledHeaders
in the cloned repository.Use(async (context, next) => await next.Invoke())
in Startup.cs, re-run and see all the correct headers being returnedReproducible on ASP.NET Core 3.0 and 3.1. There is also a package reference to the ASP.NET Core 2.1/2.2 backport of the header propagation middleware, on which it is reproducible as well.
Expected behavior
The correct headers (i.e. the ones included in the current request) should be propagated on requests sent by HTTP Clients to which the header-propagating message handler has been added.
Screenshots
Additional context
I don't think it matters here, but the bug reporting template says to include the output of
dotnet --info
, so here it is:The text was updated successfully, but these errors were encountered: