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

Remove and ban usage of [Inheritable]ThreadLocal #463

Open
1 task done
snazy opened this issue Nov 21, 2024 · 0 comments · May be fixed by #589
Open
1 task done

Remove and ban usage of [Inheritable]ThreadLocal #463

snazy opened this issue Nov 21, 2024 · 0 comments · May be fixed by #589
Labels
bug Something isn't working

Comments

@snazy
Copy link
Member

snazy commented Nov 21, 2024

Is this a possible security vulnerability?

  • This is NOT a possible security vulnerability

Describe the bug

While [Inheritable]ThreadLocals are relatively easy to start with to pass along request related information, ThreadLocals come with a non-negligible cost and maintenance burden:

  • TLs can cause very hard to detect memory leaks as objects (and classes!) are (often permanently) attached to a thread.
  • TLs and their usage are hard to test
  • (The use of) TLs can accidentally share data across requests
  • Use of TLs becomes complex and hard to reason about

The proper way of sharing request related information is to use CDI's @RequestScoped beans.

To Reproduce

No response

Actual Behavior

No response

Expected Behavior

No response

Additional context

No response

System information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant