[ https://issues.apache.org/jira/browse/VELOCITY-934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17232389#comment-17232389 ]
Michael Osipov commented on VELOCITY-934: ----------------------------------------- I did not say that they are not threadsafe per sé, but I would expect that thread safety is documented as such. [~cbrisson], what is your view? I don't know enough about the code to make bold statements. > NullPointerException under high concurrency > ------------------------------------------- > > Key: VELOCITY-934 > URL: https://issues.apache.org/jira/browse/VELOCITY-934 > Project: Velocity > Issue Type: Bug > Components: Engine > Affects Versions: 1.7.x, 2.2 > Environment: Windows 10 Professional > Reporter: Andreas Hager > Priority: Major > > I adjusted the mboseke/template-benchmark to profile throughput on AMD Ryzen > 5950x: > [https://github.com/casid/template-benchmark/tree/ryzen-5950x] > With 32 concurrent threads, I can reliably reproduce a runtime exception in > the Apache Velocity benchmark: > {code:java} > java.lang.NullPointerException > at > org.apache.velocity.runtime.directive.Directive.postRender(Directive.java:240) > at > org.apache.velocity.runtime.directive.Foreach.clean(Foreach.java:325) > at > org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:292) > at > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:301) > at > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:423) > at org.apache.velocity.Template.merge(Template.java:358) > at org.apache.velocity.Template.merge(Template.java:262) > at com.mitchellbosecke.benchmark.Velocity.benchmark(Velocity.java:34) > at > com.mitchellbosecke.benchmark.generated.Velocity_benchmark_jmhTest.benchmark_thrpt_jmhStub(Velocity_benchmark_jmhTest.java:122) > at > com.mitchellbosecke.benchmark.generated.Velocity_benchmark_jmhTest.benchmark_Throughput(Velocity_benchmark_jmhTest.java:69) > at jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown > Source) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > at > org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:430) > at > org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:412) > at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) > at > java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) > at > java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) > at java.base/java.lang.Thread.run(Thread.java:834) > {code} > This initially happened with version 1.7, but after updating to 2.2 the > problem is still there. It looks like there is some threading issue under > high concurrency. > This is the velocity benchmark class: > [https://github.com/casid/template-benchmark/blob/ryzen-5950x/src/main/java/com/mitchellbosecke/benchmark/Velocity.java] > And this is the velocity template: > [https://github.com/casid/template-benchmark/blob/ryzen-5950x/src/main/resources/templates/stocks.velocity.html] > > > > -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org