Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-16788

Resource leakage due to absence of close() call on connector start failure



    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • None
    • None
    • connect
    • None


      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:  

      1. Initiate a connector that creates or allocates resources (for instance, threads) during the execution of the start() method.
      2. Generate a problem that, during the start() process, either triggers an exception or invokes the raiseError(Exception e) method of the WorkerConnectorContext.
      3. 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. 


        Issue Links



              ashok89 Ashok
              ashok89 Ashok
              0 Vote for this issue
              2 Start watching this issue