[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Intermittent hang/deadlock when iterating through LDAP search results using JLDAP
- To: openldap <openldap-software@OpenLDAP.org>
- Subject: Intermittent hang/deadlock when iterating through LDAP search results using JLDAP
- From: Safdar Kureishy <safdar.kureishy@gmail.com>
- Date: Thu, 8 Sep 2005 12:18:04 -0700
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=Z1l4fMo6bTOAXCVyKKZvO5F0/tys4B6Jyd9p/xLswVPP0cQ/ccPG+OF1t6EOs/xYxo3mYPkF6nSTvrTR/rJe45CoU2OKtNX0F/LCD6wybHOt5RC4KbCCh0b4S7fuq+7S0eyMNq/NBsLe2C1feEbE+jeL1DHw+E6VcoNL63e3aJw=
Hi,
I'm using JLDAP to access an OpenLDAP server and query for information.
There are situations (intermittent) where search result iteration returned
via
LDAPConnection::search() (synchronous search) ends up in a deadlock/hang of
some sort.
Here are some strack traces:
Thread [http-8453-Processor2] (Suspended)
Object.wait(long) line: not available [native method]
MessageVector(Object).wait() line: 429 [local variables unavailable]
MessageAgent.getLDAPMessage(Integer) line: not available
LDAPSearchQueue(LDAPMessageQue ue).getResponse(Integer) line: not available
LDAPSearchQueue(LDAPMessageQueue).getResponse() line: not available
LDAPSearchResults.getBatchOfResults() line: not available
LDAPSearchResults.resetVectors() line: not available
LDAPSearchResults.hasMore() line: not available [local variables
unavailable]
I also see a stack dump alongside this that might be related to it at
the network level:
Thread [http-8454-Processor4] (Suspended)
PlainSocketImpl.socketAccept(SocketImpl) line: not available [native method]
PlainSocketImpl.accept(SocketImpl) line: 353
SSLServerSocketImpl(ServerSocket).implAccept(Socket) line: 448
SSLServerSocketImpl.accept() line: not available
JSSE14SocketFactory(JSSESocketFactory).acceptSocket(ServerSocket) line: 110
PoolTcpEndpoint.acceptSocket() line: 368
TcpWorkerThread.runIt(Object[]) line: 549
ThreadPool$ControlRunnable.run() line: 683
ThreadWithAttributes(Thread).run() line: 534
Another similar stack trace is:
Thread [http-8444-Processor15] (Suspended)
Object.wait(long) line: not available [native method] [local variables
unavailable]
MessageVector(Object).wait() line: 429
MessageAgent.getLDAPMessage(Integer) line: not available
LDAPSearchQueue(LDAPMessageQueue).getResponse(Integer) line: not available
LDAPSearchQueue(LDAPMessageQueue).getResponse() line: not available
LDAPSearchResults.getBatchOfResults() line: not available
LDAPSearchResults.resetVectors() line: not available
LDAPSearchResults.hasMore() line: not available
OpenLDAPQueryImpl.execute() line: 153
Is anyone familiar with the solution/workaround to this problem? I'm not
using
SSL for now, but I plan to eventually switch to using SSL as well.
Here is the code I'm using to invoke the search (it's a pretty simple
search). I obtain a connection instance by cloning a "master"
connection. After I've iterated through all the results, I close the
cloned connection. According to the Javadoc for this, the call to
close() on the cloned connection should not affect the master
connection in any way.
// Here I initialize the master connection:
...
this.masterConnection.connect(host, port);
this.masterConnection.bind(LDAPConnection.LDAP_V3,
this.loginDN, passwd);
...
// Here I search by cloning the master connection:
...
...
LDAPConnection connection = this.masterConnection.clone();
LDAPSearchResults results = connection.search(this.baseDN,
ldapScope, searchStr, requestedAttributes, false);
try {
while (results.hasMore()) { <<<<<< THIS IS WHERE THE
HANG/DEADLOCK OCCURS
LDAPEntry nativeEntry = results.next();
LDAPAttribute idAttr =
nativeEntry.getAttribute(this.staticIdAttribute);
...
...
} finally {
// Always release the connection:
this.adapter.getConnectionPoolManager().releaseConnection(connection);
}
Any help will be greatly appreciated.
Thanks,
Safdar