Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2172

Memory leak when using TLS/SSL mongo connections on Python 2.7

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.9, 3.10.1
    • Component/s: Connection Mgmt
    • None
    • Environment:
      Platform: "Linux-4.4.0-1062-aws-x86_64-with-debian-stretch-sid" (heroku dynos)
      Python version: 2.7.12
      I have tested 3.9[srv], and 3.10.1[srv] and 3.10.1[srv,tls]

      After moving our system from mlab (not using TLS), to mongodb atlas (requires TLS) we saw an immediate memory leak on all dyno's running mongo connections (more mongo connections - more aggressive memory leak).

       

      I found this a few days after the release, and have verified that re-connecting to the non SSL version at mLab goes back to the prior behavior of non-increasing memory. I gave that dyno type load by sending it a variety of requests that cause read and writes to mongo. I have also verified that simply connecting to the db connection and doing a find/read (with no other application logic except django overhead) causes the same issue as well. The smoking gun is that resetting to the old non SSL version of the mongo connection fixes the issue completely from the telemetry that I can see. 

       

      My guess is that something in the SSL handshake portion of the library has the memory leak - but I have not been able to isolate where this occurs.

       

      Attaching load testing telemetry of memory consumption vs load. (from 03-23)

       

      Attaching view of memory consumption in production with change in pattern on Wed @5pm (from 3-20) that is when we turned the TLS mode on.

       

       

        1. Screen Shot 2020-03-20 at 4.20.03 PM.png
          144 kB
          Dave Merritt
        2. Screen Shot 2020-03-23 at 12.11.56 PM.png
          185 kB
          Dave Merritt

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            dave@zenput.com Dave Merritt
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: