Closed
Bug 218742
Opened 22 years ago
Closed 22 years ago
Deadlock in LDAPConnection & LDAPConnThread
Categories
(Directory Graveyard :: LDAP Java SDK, defect)
Tracking
(Not tracked)
People
(Reporter: peter_bower2003, Assigned: erhyuan)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3.1) Gecko/20030425
Build Identifier: Directory SDK 4.1 for Java Source Code
The LDAPConnection & LDAPConnThread threads can deadlock. The following
stack traces illustrate the problem.
"ExecuteThread: '4' for queue: 'default'" daemon prio=1 tid=0x826fbd8
nid=0x407 waiting for monitor entry [0x7c6fe000..0x7c6ff870]
at netscape.ldap.LDAPConnThread.getClientCount(LDAPConnThread.java:231)
at netscape.ldap.LDAPConnection.disconnect(LDAPConnection.java:1896)
at ...
"LDAPConnThread 192.168.224.224:389" daemon prio=1 tid=0x8566b48 nid=0x5f04
waiting for monitor entry [0x873ff000..0x873ff870]
at
netscape.ldap.LDAPConnection.deregisterConnection(LDAPConnection.java:1937)
at netscape.ldap.LDAPConnThread.cleanUp(LDAPConnThread.java:334)
at netscape.ldap.LDAPConnThread.networkError(LDAPConnThread.java:627)
at netscape.ldap.LDAPConnThread.run(LDAPConnThread.java:436)
The following code changes resolve the problem.
his Patch contains Two Classes
1.netscape.ldap.LDAPConnThread
2.netscape.ldap.LDAPConection
The Diff for the modified source is as follows.
For nestcape.ldap.LDAPConnThread
230c230
< /* synchronized */ int getClientCount() {
---
> synchronized int getClientCount() {
For netscape.ldap.LDAPConnection
259c259,261
<
---
> private boolean isCleaningUp;
> private Object lock = new Object();
>
1894d1896
<
1900a1901
>
1936,1940c1938,1959
< synchronized void deregisterConnection() {
< m_thread.deregister(this);
< m_thread = null;
< m_bound = false;
< }
---
> void deregisterConnection() {
> if (isCleaningUp)
> return;
> synchronized(lock) {
> if (isCleaningUp)
> return;
> else
> isCleaningUp=true;
> }
> synchronized(this) {
> m_thread.deregister(this);
> m_thread = null;
> m_bound = false;
> }
> }
Reproducible: Sometimes
Steps to Reproduce:
1. Have one thread attempt to bind to LDAP server - a failure occurs
2. After failure, thread calls conn.disconnect() to cleanup
3. LDAPConnection thread and user thread then deadlock
Actual Results:
Both threads hang with deadlock.
Expected Results:
See code changes.
| Assignee | ||
Comment 2•22 years ago
|
||
The jdb stack trace is same as one in bug 67413.
According to the Mirodrag's comments, this was fixed.
You seem using the old JDK 4.1, please try latest 4.17 from JDK page
at http://www.mozilla.org/directory/javasdk.html.
*** This bug has been marked as a duplicate of 67413 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•