[jira] [Created] (OGNL-25) Check on Concurrency correctness of SimpleNode.evaluateGetValueBody

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (OGNL-25) Check on Concurrency correctness of SimpleNode.evaluateGetValueBody

Gilles (Jira)
Check on Concurrency correctness of SimpleNode.evaluateGetValueBody
-------------------------------------------------------------------

                 Key: OGNL-25
                 URL: https://issues.apache.org/jira/browse/OGNL-25
             Project: OGNL
          Issue Type: Bug
            Reporter: Daniel Pitts


Looking at this, it looks suspiciously like it has concurrency issues.

In particular:
<code>
        if ( !_constantValueCalculated )
        {
            _constantValueCalculated = true;
            boolean constant = isConstant( context );

            if ( constant )
            {
                _constantValue = getValueBody( context, source );
            }

            _hasConstantValue = constant;
        }
</code>

In concurrent situations, _constValueCalculated could get set to true, before the rest of the if statement is completed.  On top of that, _constantValueCalculated isn't volatile, so there is no appropriate memory barrier and data may not be set as expected.

I'll attach a patch which should fix the issues.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OGNL-25) Check on Concurrency correctness of SimpleNode.evaluateGetValueBody

Gilles (Jira)

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

Daniel Pitts commented on OGNL-25:
----------------------------------

Actually, looking at this more closely, and there isn't really an issue.

               

> Check on Concurrency correctness of SimpleNode.evaluateGetValueBody
> -------------------------------------------------------------------
>
>                 Key: OGNL-25
>                 URL: https://issues.apache.org/jira/browse/OGNL-25
>             Project: OGNL
>          Issue Type: Bug
>            Reporter: Daniel Pitts
>
> Looking at this, it looks suspiciously like it has concurrency issues.
> In particular:
> <code>
>         if ( !_constantValueCalculated )
>         {
>             _constantValueCalculated = true;
>             boolean constant = isConstant( context );
>             if ( constant )
>             {
>                 _constantValue = getValueBody( context, source );
>             }
>             _hasConstantValue = constant;
>         }
> </code>
> In concurrent situations, _constValueCalculated could get set to true, before the rest of the if statement is completed.  On top of that, _constantValueCalculated isn't volatile, so there is no appropriate memory barrier and data may not be set as expected.
> I'll attach a patch which should fix the issues.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Closed] (OGNL-25) Check on Concurrency correctness of SimpleNode.evaluateGetValueBody

Gilles (Jira)
In reply to this post by Gilles (Jira)

     [ https://issues.apache.org/jira/browse/OGNL-25?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Pitts closed OGNL-25.
----------------------------

    Resolution: Not A Problem
   

> Check on Concurrency correctness of SimpleNode.evaluateGetValueBody
> -------------------------------------------------------------------
>
>                 Key: OGNL-25
>                 URL: https://issues.apache.org/jira/browse/OGNL-25
>             Project: OGNL
>          Issue Type: Bug
>            Reporter: Daniel Pitts
>
> Looking at this, it looks suspiciously like it has concurrency issues.
> In particular:
> <code>
>         if ( !_constantValueCalculated )
>         {
>             _constantValueCalculated = true;
>             boolean constant = isConstant( context );
>             if ( constant )
>             {
>                 _constantValue = getValueBody( context, source );
>             }
>             _hasConstantValue = constant;
>         }
> </code>
> In concurrent situations, _constValueCalculated could get set to true, before the rest of the if statement is completed.  On top of that, _constantValueCalculated isn't volatile, so there is no appropriate memory barrier and data may not be set as expected.
> I'll attach a patch which should fix the issues.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira