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

Add cleanup of ThreadLocal for reusable threads from the pool. #1582

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

ewelinagr
Copy link
Member

ThreadLocal variable is used in Saturn RequestContext to store user IRI within a thread.

When using thread pools the threads are reused, so the user IRI used previously for a thread was preserved and was reused for a different request and often different user, causing invalid request user being handled.

This PR adds ThreadLocal variables cleanup before each new request using request filters.

See: https://www.baeldung.com/java-threadlocal#threadlocalsand-thread-pools

@ewelinagr ewelinagr requested a review from pvannierop February 25, 2025 15:33
@ewelinagr ewelinagr force-pushed the bugfix/thread-local-cleanup branch from 27dbceb to dd6c669 Compare February 26, 2025 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant