Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Information Provided
-
1.7.x, 2.2
-
None
-
None
-
Windows 10 Professional
Description
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:
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)
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:
And this is the velocity template: