From 0a0ed252bb022406397ce9a87af99d9ac32c9bb7 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 17 Sep 2010 22:51:17 +0000
Subject: [PATCH] Fix potential OOME when under heavy asynchronous search load by making work queue capacity finite so that clients are blocked when the queue is full
---
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java | 60 ++++++++++++++++++++++++++++++------------------------------
1 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index 9e8809c..f544e1c 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -1194,16 +1194,16 @@
// We need to grab a lock to ensure that no one else can add
// operations to the queue while we are performing some preliminary
// checks.
- synchronized (opsInProgressLock)
+ try
{
- try
+ synchronized (opsInProgressLock)
{
// If we're already in the process of disconnecting the client,
// then reject the operation.
if (disconnectRequested)
{
Message message =
- WARN_LDAP_CLIENT_DISCONNECT_IN_PROGRESS.get();
+ WARN_LDAP_CLIENT_DISCONNECT_IN_PROGRESS.get();
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
message);
}
@@ -1217,41 +1217,41 @@
if (op != null)
{
Message message =
- WARN_LDAP_CLIENT_DUPLICATE_MESSAGE_ID.get(messageID);
+ WARN_LDAP_CLIENT_DUPLICATE_MESSAGE_ID.get(messageID);
throw new DirectoryException(ResultCode.PROTOCOL_ERROR,
message);
}
-
- // Try to add the operation to the work queue,
- // or run it synchronously (typically for the administration
- // connector)
- connectionHandler.getQueueingStrategy().enqueueRequest(
- operation);
}
- catch (DirectoryException de)
+
+ // Try to add the operation to the work queue,
+ // or run it synchronously (typically for the administration
+ // connector)
+ connectionHandler.getQueueingStrategy().enqueueRequest(
+ operation);
+ }
+ catch (DirectoryException de)
+ {
+ if (debugEnabled())
{
- if (debugEnabled())
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, de);
- }
-
- operationsInProgress.remove(messageID);
- lastCompletionTime.set(TimeThread.getTime());
-
- throw de;
+ TRACER.debugCaught(DebugLogLevel.ERROR, de);
}
- catch (Exception e)
+
+ operationsInProgress.remove(messageID);
+ lastCompletionTime.set(TimeThread.getTime());
+
+ throw de;
+ }
+ catch (Exception e)
+ {
+ if (debugEnabled())
{
- if (debugEnabled())
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
- }
-
- Message message =
- WARN_LDAP_CLIENT_CANNOT_ENQUEUE.get(getExceptionMessage(e));
- throw new DirectoryException(DirectoryServer
- .getServerErrorResultCode(), message, e);
+ TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
+
+ Message message =
+ WARN_LDAP_CLIENT_CANNOT_ENQUEUE.get(getExceptionMessage(e));
+ throw new DirectoryException(DirectoryServer
+ .getServerErrorResultCode(), message, e);
}
}
--
Gitblit v1.10.0