Blogs
The design of workflowContext in KaleoInstance is not fork/thread/cluster safe. There is no database row level locking to prevent dirty reads from and competing writes to workflowContext as a Map or as a string. This also applies to Java code and KaleoTaskInstanceToken.workflowContext and KaleoTimerInstanceToken.workflowContext.
I propose this change, which prevents developers from putting custom values in "workflowContent" in one <script> block, hoping another <script> block can retrieve them:
https://github.com/liferay/liferay-portal/pull/3795/commits/2e4c855964564bdc5e2ad8f8d09d1e41f37b827d
The problem is most obvious when there are forks in the workflow. Each path of the fork will be "walked" by a separate Kaleo thread or even in a different JVM of a Liferay cluster. There is no proper concurrency implementation to support that.
Liferay should add explicit declaration of this design and behavior in documentations like https://help.liferay.com/hc/en-us/articles/360028818852-Leveraging-the-Script-Engine-in-Workflow

