On May 11, 2012, at 3:53 PM, Adam Heath wrote: > Haven't yet looked at those urls, but just based on your description, the > only way to fix code that has broken locking is to wrap it in synchronized. > If you use non-locking techniques, the code being called might still be run > in parallel, which won't help the situation. > > Let me look into this further before you this code is changed. > > If I find out that there is a fixed freemarker(or, I come up with a patch), > then I assume we'd be for including that fixed freemarker. What about > backporting that to other branches(just the locking fix for freemarker, plus > whatever locking fix in ofbiz)?
I already proposed a fix for the deadlock condition in freemarker, they asked me to send a signed icla (I already sent it to them) and we will have to wait a bit before it is committed. The fix I did in OFBiz fixes exactly what I described: * before my fix the same script could be parsed multiple times and added to the cache by several threads running a script not in the cache: at the end the parsed script in the cache was the one processed by the slowest thread (i.e. each thread was overriding the value put by the previous thread) * after my fix the same script could be parsed multiple times by several threads running a script not in the cache; but only the fastest thread is now adding a value to the cache: at the end the parsed script in the cache is the one processed by the fastest thread Please read the whole story if you are interested but at this point the problem (yes, the problem was real) is resolved. Jacopo