-
Bug
-
Resolution: Fixed
-
P2
-
9, 11, 12, 13
-
b10
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8245802 | 13.0.4 | Pavel Rappo | P2 | Resolved | Fixed | b03 |
JDK-8237876 | 11.0.8-oracle | Pavel Rappo | P2 | Closed | Fixed | b01 |
JDK-8240434 | 11.0.8 | Pavel Rappo | P2 | Resolved | Fixed | b01 |
JDK-8249807 | openjdk8u272 | Pavel Rappo | P2 | Resolved | Fixed | b01 |
JDK-8254201 | 8u281 | Robert Mckenna | P2 | Resolved | Fixed | b02 |
JDK-8248118 | 8u271 | Robert Mckenna | P2 | Closed | Fixed | b01 |
JDK-8248718 | 8u261 | Robert Mckenna | P2 | Closed | Fixed | b32 |
JDK-8257337 | emb-8u281 | Robert Mckenna | P2 | Resolved | Fixed | team |
JDK-8251719 | emb-8u271 | Robert Mckenna | P2 | Resolved | Fixed | team |
Behavior should be the same for all OS versions.
A DESCRIPTION OF THE PROBLEM :
The LdapContext#reconnect method allows LDAP clients to initiate an LDAP bind operation on the existing connection. Invoking this method should not open a new connection under those circumstances.
The change in this commit: https://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/021b47694183
adds a reconnect flag that does not discriminate, causing a new connection to be opened even in the case of performing a bind.
I believe further analysis will show that the previous open connection is also orphaned, that is it does not get properly torn down.
REGRESSION : Last worked in version 8u191
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
You will need an LDAP server and an entry on that server with ACLs that allow you to bind as that entry.
Compile and execute the supplied source code, providing (3) command line arguments:
1) the URL for the LDAP server
2) the DN of the entry to bind as
3) the password for the DN
From a command line execute:
java JndiReconnectBug ldap://my.ldap-server.domain 'uid=test,ou=account,dc=org,dc=domain' 'password'
During the first sleep, examine the open connections from your host to the directory.
(netstat is a common tool for this)
During the second sleep, examine the open connections again
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
During the first sleep you will see the open connection created by instantiating the InitialLdapContext.
During the second sleep you will see the same connection that has performed an LDAP bind operation.
ACTUAL -
During the first sleep you will see the open connection created by instantiating the InitialLdapContext.
During the second sleep you will see the original connection and a new connection created by the call to reconnect.
---------- BEGIN SOURCE ----------
import java.nio.charset.StandardCharsets;
import java.util.Hashtable;
import javax.naming.ldap.InitialLdapContext;
public final class JndiReconnectBug
{
public static void main(String[] args) throws Exception {
Hashtable<String, Object> env = new Hashtable<>();
env.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory");
env.put("java.naming.ldap.version", "3");
env.put("java.naming.provider.url", args[0]);
// open connection
InitialLdapContext context = new InitialLdapContext(env, null);
System.out.println("Check open connections");
Thread.sleep(10000);
// send bind request
context.addToEnvironment("java.naming.security.authentication", "simple");
context.addToEnvironment("java.naming.security.principal", args[1]);
context.addToEnvironment("java.naming.security.credentials", args[2].getBytes(StandardCharsets.UTF_8));
context.reconnect(null);
System.out.println("Check open connections");
Thread.sleep(10000);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No work around found.
FREQUENCY : always
- backported by
-
JDK-8240434 LdapContext#reconnect always opens a new connection
-
- Resolved
-
-
JDK-8245802 LdapContext#reconnect always opens a new connection
-
- Resolved
-
-
JDK-8249807 LdapContext#reconnect always opens a new connection
-
- Resolved
-
-
JDK-8251719 LdapContext#reconnect always opens a new connection
-
- Resolved
-
-
JDK-8254201 LdapContext#reconnect always opens a new connection
-
- Resolved
-
-
JDK-8257337 LdapContext#reconnect always opens a new connection
-
- Resolved
-
-
JDK-8237876 LdapContext#reconnect always opens a new connection
-
- Closed
-
-
JDK-8248118 LdapContext#reconnect always opens a new connection
-
- Closed
-
-
JDK-8248718 LdapContext#reconnect always opens a new connection
-
- Closed
-
- duplicates
-
JDK-8218626 LdapContext#reconnect() leads to a memory leak and open network connect
-
- Closed
-
-
JDK-8230746 Class LdapCtx create unclosed socket when attempt to reconnect
-
- Closed
-
-
JDK-8215204 Thread leak when calling LdapContext.reconnect
-
- Closed
-
-
JDK-8210696 Implement a generalized reusable dummy ldap server for tests
-
- Closed
-
- relates to
-
JDK-8240208 Implement LdapPlaybackServer based on BaseLdapServer
-
- Open
-
-
JDK-8059009 LDAPCertStore fails to retrieve CRL after LDAP server closes idle connection
-
- Closed
-