From ad1e1e776a8f5386df8237af2bc413446c4d8762 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 25 Feb 2011 18:47:49 +0000
Subject: [PATCH] Fix for OPENDJ-55: Failing modify operations causing memory leak. The memory leak is happening when PreOperation plugins are aborting an update (like UniqueAttributePlugin). Several issues with the whole plugin manager, preOperation and postOperation plugins. 1/ The postOperation method of a plugin was always called even when the PreOp was skipped. This is due to an error in the ModifyOperationWrapper equals method (A.equals(A) was always false). As a result, the concurrentHashMap of skipped plugins was never cleaned and leaked memory big time. 2/ The postOperation method for most of the registered plugin would not check if the operation was successful or not before processing. This could possibly create issues with Access Controls, Groups or Subentries.  3/ The UniqueAttributePlugin would not clean the concurrentHashMap of attribute values being checked for uniqueness, on errors. On success, it's done in the PostOperation method. On errors, the PostOperation method is not called, so the PreOp needs to cleans it before returning. For this we're now keeping a list of values added to the ConcurrrentHashMap, and remove them before returning an error.

---
 opends/src/server/org/opends/server/core/ModifyOperationWrapper.java |   17 +----------------
 1 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/ModifyOperationWrapper.java b/opends/src/server/org/opends/server/core/ModifyOperationWrapper.java
index d2fd62f..ebecafd 100644
--- a/opends/src/server/org/opends/server/core/ModifyOperationWrapper.java
+++ b/opends/src/server/org/opends/server/core/ModifyOperationWrapper.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 package org.opends.server.core;
 
@@ -74,14 +75,6 @@
   /**
    * {@inheritDoc}
    */
-  public boolean equals(Object obj)
-  {
-    return modify.equals(obj);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
   public DN getEntryDN()
   {
     return modify.getEntryDN();
@@ -114,14 +107,6 @@
   /**
    * {@inheritDoc}
    */
-  public int hashCode()
-  {
-    return modify.hashCode();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
   public void setRawEntryDN(ByteString rawEntryDN)
   {
     modify.setRawEntryDN(rawEntryDN);

--
Gitblit v1.10.0