Why Thread Pools Leak User Data: ThreadLocal Internals and Solutions
This article explains how a static ThreadLocal without cleanup in a thread pool causes user data leakage and memory leaks, details ThreadLocalMap's weak-reference Entry structure, demonstrates InheritableThreadLocal's failure with pooled threads, and presents solutions including try-finally cleanup, interceptor-based clearing, Alibaba's TransmittableThreadLocal, and an AutoCloseable wrapper for safe scoping.
