Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-417

Memory leak in IoServiceListenerSupport.managedSessions when clients cut connections quickly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.13.0
    • None
    • None

    Description

      Raised from https://jira.atlassian.com/browse/STASH-7105

      If you open and close a connection really fast it seems to hold onto lots of them in IoServiceListenerSupport

      In the wild this is sometimes caused by haproxy health checks.
      Can be reproduced running this python script

      import socket
      import sys
      
      TCP_IP = '127.0.0.1'
      TCP_PORT = 7999
      
      def makeTestConnection():
              s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
              s.connect((TCP_IP, TCP_PORT))
              s.close()
      
      numConnections = 10000
      if len(sys.argv) == 2:
              numConnections = int(sys.argv[1])
      
      for i in range(numConnections):
              print(str(i))
              makeTestConnection()
      

      If you take a heap dump afterwards you will see lots of session objects.
      There seems to be a 2 minute auth timeout that gets hit and some of the sessions are removed but the majority are not removed.
      Creating 10000 connections in seems to result in around 7000 of them hanging around.

      Attachments

        1. Screen Shot 2015-02-25 at 10.18.13 pm.png
          228 kB
          Chris Szmajda
        2. Screen Shot 2015-02-25 at 10.18.36 pm.png
          132 kB
          Chris Szmajda
        3. Screen Shot 2015-02-25 at 10.18.51 pm.png
          226 kB
          Chris Szmajda
        4. Screen Shot 2015-02-25 at 10.19.04 pm.png
          149 kB
          Chris Szmajda
        5. Screen Shot 2015-02-25 at 10.19.14 pm.png
          135 kB
          Chris Szmajda
        6. Screen Shot 2015-02-25 at 10.19.49 pm.png
          142 kB
          Chris Szmajda
        7. Screen Shot 2015-02-26 at 5.19.21 pm.png
          80 kB
          Scott Goodhew
        8. testing-stash-7105.zip
          2 kB
          Chris Szmajda

        Issue Links

          Activity

            People

              gnodet Guillaume Nodet
              cszmajda Chris Szmajda
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: