Create a connector with a flush.interval.ms set to a reasonable time (~ 5 seconds)
Observe that a new Timer-{index} thread is created for the connector (via jmx/visualvm)
Delete the connector, and observe the Timer-{index} thread is not deleted.
Alternatively/additionally
add a logging statement to the FileWriter.flushByTimeImpl method.
recompile/deploy sink.
Create a connector, and observe your new logging statement.
Delete the connector, continue to observe your new logging statement.
These timer threads should be tied to the lifecycle of the connector's tasks.
This leak actually occurs whenever there is a shuffle of topic partitions. Old TopicPartitionWriters get closed, and new ones get created, but the timers are never stopped. Here is the shape of thread growth in one of our deployments:
Steps to reproduce:
flush.interval.ms
set to a reasonable time (~ 5 seconds)Timer-{index}
thread is created for the connector (via jmx/visualvm)Timer-{index}
thread is not deleted.Alternatively/additionally
FileWriter.flushByTimeImpl
method.These timer threads should be tied to the lifecycle of the connector's tasks.
This leak actually occurs whenever there is a shuffle of topic partitions. Old TopicPartitionWriters get closed, and new ones get created, but the timers are never stopped. Here is the shape of thread growth in one of our deployments:
I am testing a fix, and will open a PR this week.