BewareMyPower commented on PR #24714: URL: https://github.com/apache/pulsar/pull/24714#issuecomment-3268618587
> If DataSketchesSummaryLogger.ThreadLocalAccessor is accessed by normal thread(not netty thread), map element will not be removed when thread is completed. I've suffered the same memory leak before. The key point is that we relies too much on the so-called "fast" thread local class from Netty but the thread local object is used in non-Netty threads (not `FastThreadLocalThread`) in many places. Especially when things go to the unique `onRemoval` method from `FastThreadLocal`, there is an **implicit** requirement that this thread local object must be used in `FastThreadLocalThread`. It's very unfriendly to users. I think to resolve this issue thoroughly, we should not rely on the `onRemoval` mechanism for Netty threads specially. Instead, we should call `map.remove` explicitly when detected the key is ready to remove. @lhotari We'd better migrate the internal fix that from the private KSN project to Apache Pulsar. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org