You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2011/02/09 10:36:57 UTC

[jira] Commented: (SLING-1972) JavaScript ScriptEngine is not thread safe

    [ https://issues.apache.org/jira/browse/SLING-1972?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12992410#comment-12992410 ] 

Felix Meschberger commented on SLING-1972:
------------------------------------------

Committed a fix in Rev. 1068807 which leverages the Context's top scope field which is maintained by Rhino in a thread-safe way (each Context instance is only used in a single Thread).

> 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