Chris Egerton created KAFKA-13533: ------------------------------------- Summary: Task resources are not cleaned up if task initialization fails Key: KAFKA-13533 URL: https://issues.apache.org/jira/browse/KAFKA-13533 Project: Kafka Issue Type: Bug Components: KafkaConnect Reporter: Chris Egerton Assignee: Chris Egerton
Many closeable resources are instantiated in the [Worker::buildWorkerTask method|https://github.com/apache/kafka/blob/d5eb3c10ecd394015336868f948348c62c0e4e77/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/Worker.java#L571-L636], including but not limited to: * Producers (for source tasks, and for sink tasks configured to write to a DLQ topic) * Consumers (for sink tasks) * Admin clients (for source tasks with topic creation enabled) * Transformation and Predicate instances These resources are all cleaned up correctly if the worker is able to successfully instantiate the task (see [WorkerSourceTask::close|https://github.com/apache/kafka/blob/d5eb3c10ecd394015336868f948348c62c0e4e77/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSourceTask.java#L163-L184] and [WorkerSinkTask::close|https://github.com/apache/kafka/blob/d5eb3c10ecd394015336868f948348c62c0e4e77/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/WorkerSinkTask.java#L166-L179] for how most task resources are cleaned up at the end of their lifetime). However, if anything fails during {{{}Worker::buildWorkerTask{}}}, no attempt is made to clean up any resources that were allocated before that failure. -- This message was sent by Atlassian Jira (v8.20.1#820001)