DWR

DefaultConverterManager.converters not synchronized

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 2.0.5, 3.0.RC1
  • Fix Version/s: 2.0.7
  • Component/s: Converters
  • Documentation Required:
    No
  • Description:
    Hide

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

Hide
mike c added a comment - 01/Sep/10 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();

Show
mike c added a comment - 01/Sep/10 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();
Hide
David Marginian added a comment - 01/Sep/10 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.

Show
David Marginian added a comment - 01/Sep/10 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.
Hide
David Marginian added a comment - 01/Sep/10 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.

Show
David Marginian added a comment - 01/Sep/10 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.
Hide
mike c added a comment - 03/Sep/10 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.

Show
mike c added a comment - 03/Sep/10 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.

People

Dates

  • Created:
    31/Aug/10 9:31 PM
    Updated:
    05/Oct/10 7:29 PM
    Resolved:
    05/Oct/10 7:29 PM