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.

@ThreadContextConfig does not work in Quarkus

See original GitHub issue

Describe the bug

While it is documented in https://quarkus.io/guides/context-propagation annotating

@Inject
@ThreadContextConfg(cleared = [ ... ])
ThreadContext threadContext;

does not work - the annotation seems to be ignored and all context is propagated.

Expected behavior

This annotation should work as documented in the guide https://quarkus.io/guides/context-propagation , e.g. not propagate transaction context when this is supposed to be cleared.

Actual behavior

All contexts are propagated.

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.3.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

Workaround exists:

SmallRyeContextManagerProvider.getManager().newThreadContextBuilder()
            .propagated(ThreadContext.CDI, "JAX-RS", "Servlet").cleared(ThreadContext.TRANSACTION).build();

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
gsmetcommented, Jan 5, 2022

@mkouba I created area/context-propagation . I’ll let you add the rules you want here: https://github.com/quarkusio/quarkus/blob/main/.github/quarkus-bot.yml . Even if you don’t add a pattern for the title, it’s still useful to have the bot ping the appropriate persons when we add the label and remove the needs-triage one.

0reactions
manovotncommented, Feb 8, 2022

I will look into implementing this I also stumled upon a very old issue where we apparently already knew this was missing but it got lost - https://github.com/quarkusio/quarkus/issues/6156

Read more comments on GitHub >

github_iconTop Results From Across the Web

Context Propagation in Quarkus
Using configuration ; mp.context.ThreadContext.cleared. The comma-separated set of cleared contexts. None (no context), unless neither the propagated nor cleared ...
Read more >
Manual context propagation in Quarkus native mode
One possible issue with this is that whatever changes you do to MDC on the new thread will not be propagated back to...
Read more >
Context Propagation in Quarkus
It works by capturing those contextual values that used to be in thread-locals, and restoring them when your code is called. Setting it...
Read more >
Configuring Log4j 2 - Apache Logging Services
This won't work for elements such as appenders and filters, where each element has a different name in the concise format. Appenders and...
Read more >
Structured logging in Spring Boot with Log4j2, Part 1 - Medium
For logs to be useful when debugging thorny issues, context is crucial ... but also for other newer Java frameworks like Quarkus and...
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