Cassandra creates multiple connections and not release

Author: tudou

I am using Python Cassandra-Driver 3.15.1

I have a script that runs some multiproc.

The problem is that for some reason, the connection is not properly released after calling close_connection (get_connection -> run CQL -> close_connection -> then to the end call close_cluster. This results to over hundreds of connections/sessions stay open

Any hints on where to look for the issue is very much appreciated.

def get_connection(self, timeout = 600):
    self.session = Cluster([self.host]).connect()
    self.session.default_timeout = timeout
    return self.session

def close_connection(self, conn):
    return conn.shutdown()

def close_cluster_connection(self):
    return self.cluster.shutdown()

Originally Sourced from: https://stackoverflow.com/questions/57881120/cassandra-creates-multiple-connections-and-not-release