Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when connect fails with exception AuthenticationFailed #318

Open
robertoz-01 opened this issue Apr 29, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@robertoz-01
Copy link

Every time a connection is attempted and fails with AuthenticationFailed, the memory used by the process increases.

For example, running this code:

from cassandra.cluster import Cluster

keyspace = "kkkk"
node = '10.10.10.10'

session = None
while session is None:
    try:
        scylla_cluster = Cluster([node])

        session = scylla_cluster.connect(keyspace)
    except Exception as e:
        print(e)

print("Session opened")

With a scylla node that requires authentication, this will repeatedly fail with the error message ('Unable to connect to any servers', {'10.11.12.3:9042': AuthenticationFailed('Remote end requires authentication')}) and the process will continue to increase its memory usage (on my machine it gets to around 1GB of memory usage in 2 minutes).

This is not happening in case the connection fails for another reason like, for example, ConnectionRefusedError.

Trying to debug the issue with Pympler, I can see all the objects of basic types increasing at each reconnection:

                                                types |   # objects |   total size
===================================================== | =========== | ============
                                                 list |      179515 |    167.57 MB
                                                  str |      197414 |     14.08 MB
                                                 dict |       32454 |     10.31 MB
                                    collections.deque |        8813 |      9.55 MB
                                                  int |      140409 |      3.77 MB
@roydahan roydahan added the bug Something isn't working label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants