Q&A
Q&AWhat can ThreadLocal break when used with a thread pool?
Pooled threads outlive requests, so forgotten thread-local values can leak data and memory across tasks.
Read the concise answer
Thread pools reuse worker threads. A ThreadLocal value can remain attached after a request ends, retaining large objects or exposing one request’s context to a later task if it is not overwritten. Clear it in a finally block or use a scoped context mechanism with well-defined propagation and cleanup.