[ 
https://issues.apache.org/jira/browse/DIRSERVER-1377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721820#action_12721820
 ] 

Emmanuel Lecharny commented on DIRSERVER-1377:
----------------------------------------------

Well, you still have to handle all the cases, as a JdbmTable not allowing 
duplicates will have a simple type *only* and the JdbmTable allowing duplicates 
will allow *only* composite types. It just split the problem in two parts.

But IMO, you have to deal with simple type.

--- AvlTree manipulation ---

When you have deserialized the AvlTree, you have a data structure which is 
totally thread safe. The problem is when you deserialize it from a byte[] which 
is a reference to something that can be modified by another thread, as it's a 
reference. If you do the de/ser into JDBM, as the retrieve/remove/put methos 
are synchronized, this is safe, as no thread can touch the byte[] while you are 
deserializing it. 

Now, it will be costly. Another optuion would be to have a ByteArraySerializer 
which just do a copy of the internal byte[], and returns this copy to the user. 
The thread will then deserialize something that it owns. Same thing for 
serialization, except that you don't need to copy the byte[], as it's produced 
from scratch when serializing the tree.

IMO, this is probably the way to implement the fix : easy (no need to rewrite 
all the existing marshallers) and will be faster than what we have in mind atm.

> Potential concurrency issue when adding/modifying/deleting entries at a high 
> rate
> ---------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-1377
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1377
>             Project: Directory ApacheDS
>          Issue Type: Bug
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 1.5.5
>
>
> When adding/deleting entries with many clients (a client add and delete an 
> entry many times), we may have some concurrency problem, as the index are 
> updated without concurrent acces protection.
> Synchronizing the classes where we update the index might help.

-- 
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