databricks-sql-python icon indicating copy to clipboard operation
databricks-sql-python copied to clipboard

Fixed the Issue of TCP not closing

Open jprakash-db opened this issue 1 year ago • 1 comments

Description

Currently while closing a Connection the HTTPConnectionPool is not explicitly closed and just the buffer is emptied upon closing the connection. This creates the issue of the TCP connection being in ESTABLISHED phased indefinetly and not moving to the CLOSED phase.

Fix

  • Modified the code to only close the connection in case en error occurs while making a request
  • Setting the pool as None to ensure that the Python Garbage cleanup takes care of the final closure and releasing of the port

Testing

Tested by monitoring the connection port through the lifecycle of the query to verify its working

jprakash-db avatar Dec 15 '24 10:12 jprakash-db

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

github-actions[bot] avatar Dec 15 '24 10:12 github-actions[bot]

Are there plans of merging this, Jothi? Looks like this is indeed a nice improvement on the driver.

samikshya-db avatar Jun 11 '25 12:06 samikshya-db