memory leak in BootstrapSchemaLoader (PATCH included)
-----------------------------------------------------

                 Key: DIRSERVER-1293
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1293
             Project: Directory ApacheDS
          Issue Type: Bug
         Environment: 3rd party test harness
            Reporter: Toby Stevens


BootstrapSchemaLoader uses thread local variables, which will never fall out of 
scope.

This problem effects test suites that use an embedded server.

Below is a proposed solution:


Index: 
src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java
===================================================================
--- 
src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java
       (revision 722529)
+++ 
src/main/java/org/apache/directory/server/schema/bootstrap/BootstrapSchemaLoader.java
       (working copy)
@@ -185,10 +185,18 @@
        this.registries.set( registries );
        this.schemas.set( ( BootstrapSchema ) schema );

-        for ( ProducerTypeEnum producerType:ProducerTypeEnum.getList() )
+        try
        {
-            BootstrapProducer producer = getProducer( ( BootstrapSchema ) 
schema, producerType.getName() );
-            producer.produce( registries, cb );
+               for ( ProducerTypeEnum producerType:ProducerTypeEnum.getList() )
+               {
+                   BootstrapProducer producer = getProducer( ( BootstrapSchema 
) schema, producerType.getName() );
+                   producer.produce( registries, cb );
+               }
+        }
+        finally
+        {
+            this.registries.set( null );
+            this.schemas.set( null );
        }

        notifyListenerOrRegistries( schema, registries );

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to