Ashok created KAFKA-16788:
-----------------------------

             Summary: Resource leakage due to absence of close() call on 
connector start failure
                 Key: KAFKA-16788
                 URL: https://issues.apache.org/jira/browse/KAFKA-16788
             Project: Kafka
          Issue Type: Bug
          Components: connect
            Reporter: Ashok
            Assignee: Ashok


We have identified a potential issue in the WorkerConnector class of the 
Connect framework. Specifically, the close() method is not being called on the 
connector when the connector fails to start due to various reasons. This 
omission prevents the connector from releasing any resources that were created 
or started as part of the start() method. As a result, these resources remain 
allocated even after the connector has failed to start, leading to resource 
leakage.  

To address this issue, we propose modifying the WorkerConnector class to ensure 
that the close() method is called on the connector whenever the connector fails 
to start. This change will allow the connector to properly release its 
resources, preventing resource leakage.

*Steps to Reproduce:*  
 # Initiate a connector that creates or allocates resources (for instance, 
threads) during the execution of the start() method.
 # Generate a problem that, during the start() process, either triggers an 
exception or invokes the raiseError(Exception e) method of the 
WorkerConnectorContext.
 # Notice that the close() method is not invoked on the connector, resulting in 
resource leakage, as the stop() method is where the resources are typically 
closed.

In our scenario, the issue was related to threads not being properly closed. 
These threads were initiated as part of the start() method in the connector.

*Expected Result:*  

When a connector fails to start, the close() method should be called to allow 
the connector to release its resources.  

*Actual Result:*  

The close() method is not called when a connector fails to start, leading to 
resource leakage. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to