Hello,
Our code uses latest version 2.7.3 of Jinjava. There is a new field, in Context object, that makes it impossible to share across different threads, causing exceptions when the interpreter render method is called:
Causedby: com.hubspot.jinjava.interpret.InterpretException: Errorrenderingtagatcom.hubspot.jinjava.tree.TagNode.render(TagNode.java:74)
atcom.hubspot.jinjava.interpret.JinjavaInterpreter.render(JinjavaInterpreter.java:363)
atcom.hubspot.jinjava.interpret.JinjavaInterpreter.render(JinjavaInterpreter.java:307)
at ...
Causedby: java.util.ConcurrentModificationException: nullatjava.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1605)
atjava.base/java.util.HashMap$KeyIterator.next(HashMap.java:1628)
atjava.base/java.util.AbstractSet.removeAll(AbstractSet.java:175)
atcom.hubspot.jinjava.interpret.Context.removeNonMetaContextVariables(Context.java:368)
atcom.hubspot.jinjava.lib.tag.ForTag.renderForCollection(ForTag.java:292)
atcom.hubspot.jinjava.lib.tag.ForTag.interpretUnchecked(ForTag.java:155)
atcom.hubspot.jinjava.lib.tag.ForTag.interpret(ForTag.java:120)
atcom.hubspot.jinjava.lib.tag.Tag.interpretOutput(Tag.java:27)
atcom.hubspot.jinjava.tree.TagNode.render(TagNode.java:58)
... 49commonframesomitted
I think that the field overriddenNonMetaContextVariables should allow concurrent access, otherwise client code needs to explicitly synchronize calls to render for a single top level context which holds this unique instance of this HashMap for a whole tree, which is not ideal:
this.overriddenNonMetaContextVariables =
parent == null ? newHashSet<>() : parent.overriddenNonMetaContextVariables;
There is no issue if we revert to 2.7.2 version.
Hello,
Our code uses latest version
2.7.3of Jinjava. There is a new field, inContextobject, that makes it impossible to share across different threads, causing exceptions when the interpreterrendermethod is called:I think that the field
overriddenNonMetaContextVariablesshould allow concurrent access, otherwise client code needs to explicitly synchronize calls torenderfor a single top level context which holds this unique instance of thisHashMapfor a whole tree, which is not ideal:There is no issue if we revert to
2.7.2version.