[DOCU-2908] 4Known issues: Concurrency issues in JS Models Created: 08/Nov/23  Updated: 10/Nov/23  Resolved: 10/Nov/23

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Neutral
Reporter: Martin Drápela Assignee: Martin Drápela
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoR:
Empty

 Description   

From Scot

Hey everyone. I had a call with DHL concerning the JS Models 2. They ran into concurrency issues using it, where the render cycle will unreliably fail but still result in 200 responses. Sadly, this has only come up in their staging systems. The issue comes from the fact that when the GraalVM Context is accessed concurrently, it will sometimes try to access that context from a different thread, which is an illegal access. Would be good to take a look at some solutions to make sure this doesn't happen. Fortunately, it's not a blocker for them as they are just using Freemarker scripts while they wait for a more stable JS Models module.
The fine folks at GraalVM have addressed this sort of issue with some test examples: https://www.graalvm.org/latest/reference-manual/js/Multithreading/
I also, while trying to reproduce this, played with upgrading the GraalVM dependencies to the latest 23.0.2. It seems to work, but I did have to modify the jdk11 profile a little:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --module-path=${compiler.dir} --upgrade-module-path=${compiler.dir}/compiler.jar --add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.options=ALL-UNNAMED</argLine>
</configuration>
</plugin>
(added --add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.options=ALL-UNNAMED). If you are interested in having a discussion about this, let me know.
 
------------------
 
Adding to 6.2 known issues page:
 
Concurrency issues in JS ModelsThe render cycle unreliably fails but still results in 200 responses. This issue comes from the fact that when the GraalVM Context is accessed concurrently, it will sometimes try to access that context from a different thread, which is an illegal access.


Generated at Mon Feb 12 01:31:23 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.