tomj74 / chunk-templates

Chunk Templates, a template engine for Java
http://www.x5software.com/chunk/
MIT License
77 stars 10 forks source link

java.util.ConcurrentModificationException #14

Closed slisznia closed 8 years ago

slisznia commented 8 years ago

On occasion, I'm seeing this error in the browser. Looks like Snippet.pruneCache isn't thread-safe:

URL: http://www.x5software.com/chunk/examples/ChunkExample?example=ifelse&loc=en_US

500 Servlet Exception java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841) at java.util.HashMap$EntryIterator.next(HashMap.java:883) at java.util.HashMap$EntryIterator.next(HashMap.java:881) at com.x5.template.Snippet.pruneCache(Snippet.java:94) at com.x5.template.Snippet.getSnippetFromCache(Snippet.java:62) at com.x5.template.Snippet.getSnippet(Snippet.java:50) at com.x5.template.TemplateSet.cacheTemplate(TemplateSet.java:463) at com.x5.template.TemplateSet.importTemplates(TemplateSet.java:216) at com.x5.template.TemplateSet._get(TemplateSet.java:261) at com.x5.template.TemplateSet.provides(TemplateSet.java:635) at com.x5.template.Theme.provides(Theme.java:219) at com.x5.template.eg.ExampleServlet.exampleInspectorTest(ExampleServlet.java:164) at com.x5.template.eg.ExampleServlet.handleRequest(ExampleServlet.java:80) at com.x5.template.eg.ExampleServlet.service(ExampleServlet.java:36) at javax.servlet.http.HttpServlet.service(HttpServlet.java:91) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:175) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:240) at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:424) at com.caucho.server.port.TcpConnection.run(TcpConnection.java:481) at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:685) at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:607) at java.lang.Thread.run(Thread.java:595)

tomj74 commented 8 years ago

Well, that's not good. Thanks for reporting this! I will release a fix this coming week.

tomj74 commented 8 years ago

Thanks again, this has been fixed in 3.1.3 - please update.