-
Notifications
You must be signed in to change notification settings - Fork 567
Description
What happened
Context:
The org.apache.inlong.audit.sink.PulsarSink class maintains a private static ScheduledExecutorService that is initialized in a static {} block.
Problem:
-
ClassLoader Leak (NT Defect): The static thread pool (pulsarPerformance-Printer-thread) is started immediately upon class loading and holds a strong reference to the ClassLoader. In containerized or plugin environments (like Flume/Agent), this prevents the ClassLoader from being garbage collected during hot-redeployments, leading to Metaspace OOM.
-
Shared State Corruption: Since the executor is static (global), calling stop() on any single PulsarSink instance shuts down this shared executor. This unintentionally kills the performance metric task for all other running PulsarSink instances.
What you expected to happen
-
Instance Isolation: The ScheduledExecutorService should be an instance variable, not static.
-
Lifecycle Management: The thread pool should be initialized in the start() method and shut down in the stop() method, ensuring it follows the lifecycle of the specific PulsarSink instance without affecting others.
How to reproduce
- Check the source code in org.apache.inlong.audit.sink.PulsarSink.java.
Line 129: private static ScheduledExecutorService scheduledExecutorService ...
Line 135 (Static Block): scheduledExecutorService.scheduleWithFixedDelay(...)
-
Deploy InLong Audit with multiple PulsarSink configurations.
-
Stop one sink instance.
-
Result: The pulsarPerformance-Printer-thread is terminated globally, causing other sinks to stop reporting metrics.
Environment
MacOS 13.0
JDK 1.8
InLong version
master
InLong Component
InLong Audit
Are you willing to submit PR?
- Yes, I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct