[
https://issues.apache.org/jira/browse/SLING-1972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Felix Meschberger resolved SLING-1972.
--------------------------------------
Resolution: Fixed
In Rev. 1068874 (unit test in Rev. 1068876) I write back the top level scope
properties to the Enging scope bindings which are reused as top level scope
properties on future calls with the same bindings.
So to support the SLING-1111 use case, the script must be called with (at
least) Engine scope bindings to transfer the properties from call to call.
> JavaScript ScriptEngine is not thread safe
> ------------------------------------------
>
> Key: SLING-1972
> URL: https://issues.apache.org/jira/browse/SLING-1972
> Project: Sling
> Issue Type: Bug
> Components: Scripting
> Affects Versions: Scripting JavaScript 2.0.10
> Reporter: Felix Meschberger
> Assignee: Felix Meschberger
> Priority: Critical
> Fix For: Scripting JavaScript 2.0.12
>
>
> The JavaScriptScriptEngine has a concurrency issue in that it keeps the
> top-level scope of the script executed as an instance field. Since the
> servlet resolver is caching SlingScript instances and the SlingScript has a
> reference to the ScriptEngine (JavaScriptScriptEngine in this case) executing
> the same script concurrently causes them all to use the same top-level scope
> and thus to share variables .....
> The fix is to remove the "scope" field because this is not really: The top
> level scope is maintained the by Rhino Context object which is used to
> execute the script and which manages the top level scope in a thread safe way.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira