DefaultConverterManager.converters not synchronized

Description

DefaultConverterManager could be adding to its non-synchronized map <i>converters</i> dynamically (say if the type is LinkedList or HashMap) and meanwhile DefaultRemoter is looping through the converters via DefaultConverterManager.getConverterMatchStrings(). We're seeing ConcurrentModificationException being thrown in some cases because of this.

We're sort of overcoming this by explicitly providing converters for LinkedList, HashMap, etc in dwr.xml so that DWR doesn't have to add to the hashmap on the fly.

Thanks,
Mike

Activity

Show:
mike c
September 1, 2010, 5:35 AM

I took 2.0.6 source and see some sychronized blocks have been added in DefaultConverterManager .. but not in DefaultRemoter. DefaultRemoter still iterates through the hash keys in an unsychronized fashion:

Collection converterMatches = converterManager.getConverterMatchStrings();
Iterator it = converterMatches.iterator();
while (it.hasNext())
{
String match = (String) it.next();

David Marginian
September 1, 2010, 6:03 AM

I think making and returning a copy of the keyset in getConverterMatchStrings may be a better solution than synchronizing in DefaultRemoter. I will look into it. Thanks.

David Marginian
September 1, 2010, 6:14 PM

I just checked in a fix for this. Do you have time to try it out? The latest jar was just built on the CI server - http://ci.directwebremoting.org/bamboo/browse/DWR20-ALL-11/artifact.

mike c
September 3, 2010, 3:58 PM

will checkout the source but can't really do a load test. We're experiencing thread's looping once in a while in the DefaultRemoter and are hoping the workaround I mentioned fixes it.

Assignee

David Marginian

Reporter

mike c

Labels

None

Documentation Required

No

Components

Fix versions

Affects versions

Priority

Critical
Configure