The default bug view has changed. See this FAQ.

Exceptions thrown in connect and disconnect

RESOLVED FIXED

Status

Directory
LDAP Java SDK
P3
normal
RESOLVED FIXED
17 years ago
17 years ago

People

(Reporter: Thomas.Beyer, Assigned: miodrag)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

17 years ago
Under heavy load we get from time to time the following exceptions
(LDAP-SDK 4.0, Sun's JDK 1.2.2, Solaris 2.6 and Windows NT 4.0):

------------------------ on Windows NT --------------------------------------

java.util.NoSuchElementException: Vector Enumeration
        at java.util.Vector$1.nextElement(Vector.java, Compiled Code)
        at netscape.ldap.LDAPConnection.getNewThread(LDAPConnection.java, 
Compiled Code)
        at netscape.ldap.LDAPConnection.connect(LDAPConnection.java, Compiled 
Code)
        at netscape.ldap.LDAPConnection.connect(LDAPConnection.java, Compiled 
Code)
        at netscape.ldap.LDAPConnection.connect(LDAPConnection.java, Compiled 
Code)
        at LDAP.Bind(LDAP.java, Compiled Code)
        at thr.run(thr.java, Compiled Code)

java.lang.NullPointerException
        at netscape.ldap.LDAPConnection.deleteThreadConnEntry
(LDAPConnection.java, Compiled Code)
        at netscape.ldap.LDAPConnection.disconnect(LDAPConnection.java, 
Compiled Code)
        at LDAP.Unbind(LDAP.java, Compiled Code)
        at thr.run(thr.java, Compiled Code)

------------------------ on SUN -----------------------------------------------

java.util.NoSuchElementException: Vector Enumeration
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(Compiled Code)
        at java.lang.Throwable.<init>(Compiled Code)
        at java.lang.Exception.<init>(Exception.java:42)
        at java.lang.RuntimeException.<init>(RuntimeException.java:47)
        at java.util.NoSuchElementException.<init>
(NoSuchElementException.java:46)
        at java.util.Vector$1.nextElement(Compiled Code)
        at netscape.ldap.LDAPConnection.deleteThreadConnEntry(Compiled Code)
        at netscape.ldap.LDAPConnection.disconnect(LDAPConnection.java:1772)
        at LDAP.Unbind(Compiled Code)
        at thr.run(Compiled Code)

java.lang.NullPointerException
        at netscape.ldap.LDAPConnection.deleteThreadConnEntry
(LDAPConnection.java, Compiled Code)
        at netscape.ldap.LDAPConnection.disconnect(LDAPConnection.java, 
Compiled Code)
        at LDAP.Unbind(LDAP.java, Compiled Code)
        at thr.run(thr.java, Compiled Code)

-----------------------------------------------------------------------------

The exceptions can be easily reproduced with a program that creates
some (e.g. 16) threads and each threads run methods goes like this:

LDAPConnection 	ld = new LDAPConnection ();

for (int i = 1; i <= numRuns; i++) {

  try {
    ld.connect (host,port);
    ld.disconnect ();
  } catch (LDAPException e) { ...}

}

If we synchronize the connect and disconnect calls with the same
object:
  try {
    synchronized (obj) {
      ld.connect (host,port);
    }
    synchronized (obj) {
      ld.disconnect ();
    }
  } catch (LDAPException lde) { ...}

the problems don't occur. But the SDK is proposed to be threadsafe,
so the synchronization shouldn't be necessary.

Comment 1

17 years ago
Reassigned to Miodrag.
Assignee: mcs → miodrag
(Assignee)

Updated

17 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 2

17 years ago
The problem is caused by the lack of synchronization in deleteThreadConnEntry 
method. 

The fix has been cheked in 05-06-00.

Checking in ldapjdk/netscape/ldap/LDAPConnection.java;
/cvsroot/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPConnection.java,v
 <--  LDAPConnection.java
new revision: 1.17; previous revision: 1.16
Status: ASSIGNED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.