[stringtemplate-interest] thread-safety issue in ST-4.0.4

Oliver Flege o.flege at market-maker.de
Thu Nov 24 01:41:32 PST 2011


Hi,

I just found out the hard way that
org.stringtemplate.v4.misc.ObjectModelAdaptor ist not thread-safe:

The field classAndPropertyToMemberCache can be accessed by multiple
threads at the same time.
Since org.antlr.runtime.misc.DoubleKeyMap and its internal
java.util.LinkedHashMap aren't thread-safe, parallel puts might
corrupt the map's structure (in my case: the pointers to the next
Entry ended up forming an infinite loop).

classAndPropertyToMemberCache.get/put should be synchronized on
a common mutex object.

Regards,
 Oliver



More information about the stringtemplate-interest mailing list