Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8230746

Class LdapCtx create unclosed socket when attempt to reconnect

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Centos 7 / 64 bits / OpenJDK11.0.4
      Tomcat 8.5

      A DESCRIPTION OF THE PROBLEM :
      There is some changes to this classe that cause a leak on sockets.
      The issue is probably OS independent.

      Class is com.sun.jndi.ldap.LdapCtx on private method connect.
      In case of reconnection attempt, a new LdapClient (that create a new socket) is instancied and the previous socket maintained by the previous LdapClient is not closed.

      A patch should be like that :
      if (reconnect && clnt != null) {
          clnt.closeConnection();
      }
      clnt = LdapClient.getInstance(...)


      REGRESSION : Last worked in version 8u212

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a login.config to authorize tomcat to connect to an ldap server (active directory in my case but it's clearly independent), use this config in a JMX context.
      Use a JMX client (java mission control in my case) which retrieve informations about tomcat MBean and have a look to TCP connections by using lsof linux command.
      Exit from JMX client, sockets on ldap remains (ESTABLISHED)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Sockets should be closed, I'm not using socket pooling.
      ACTUAL -
      Sockets remains opened for a long time (GC probably destroy java Socket objects and OS sockets by the way).

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: