Skip to content
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

Header value is stuck when using Reactor Hooks and Micrometer Tracing #289

Closed
akoufa opened this issue Jun 13, 2023 · 4 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@akoufa
Copy link

akoufa commented Jun 13, 2023

Describe the bug

Hello, I did setup an example project that uses 1 Spring Cloud Gateway app and 1 Spring Boot app. The Spring Cloud Gateway of course, forwards http calls to the Spring Boot app and also uses Micrometer Tracing where I have defined the header with key request-id as remote-field baggage in the application.yml . In addition, Spring Cloud Gateway has a Global Filter where it set's the header itself to a random value.

I have observed that, when calling the 2 services and providing the header explicitly in the http request, the following issue arised in the Spring Boot app where the same header is being logged:

The header value gets stuck and does never changes again, even if we provide another explicit header value in subsequent http calls.

I could identify following Spring features that produce the issue if being used together:

  • Reactor's context propagation in Spring Cloud Gateway: Hooks.enableAutomaticContextPropagation()
  • Spring Security in Spring Cloud Gateway
  • Specifying the header as a Micrometer Tracing Baggage Remote Field

It seems that, if any of the above 3 Spring features is not being used, that the issue stops being present.

I am sorry if the explanation above is difficult to read and understand and if it does not describe the problem very well and clear, but it's a very complex issue that only arises due to some very specific constellation. However the above 3 features are often used in a lot of production apps which makes the issue very relevant.

Sample

You can checkout the sample project here with a short README with the steps needed to reproduce the issue

P.S.

I am not sure if this is the correct place for this issue but to be sure I have opened the issue in this repo too. Please close this if not relevant.

Issue in Spring Cloud Gateway repo: spring-cloud/spring-cloud-gateway#2982

@marcingrzejszczak
Copy link
Contributor

Since Jun we've created numerous fixes for Reactor. Can you double check if the problem persists with the latest versions?

@akoufa
Copy link
Author

akoufa commented Aug 28, 2023

@marcingrzejszczak Yes this issue seems to be fixed. Thank you. Can we link it with any PR or specific change that fixed it so we can guard against possible regressions in the future?

@marcingrzejszczak
Copy link
Contributor

@marcingrzejszczak marcingrzejszczak closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2023
@marcingrzejszczak marcingrzejszczak added duplicate This issue or pull request already exists and removed waiting for feedback labels Aug 28, 2023
@marcingrzejszczak
Copy link
Contributor

Thanks for testing it out and telling us that things got better :) cc @chemicL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants