You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Whitlock (JIRA)" <ji...@apache.org> on 2012/04/29 22:03:52 UTC

[jira] [Created] (OGNL-49) "Double-checked locking" anti-pattern in OgnlRuntime

Matt Whitlock created OGNL-49:
---------------------------------

             Summary: "Double-checked locking" anti-pattern in OgnlRuntime
                 Key: OGNL-49
                 URL: https://issues.apache.org/jira/browse/OGNL-49
             Project: Commons OGNL
          Issue Type: Bug
         Environment: java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
            Reporter: Matt Whitlock
            Priority: Critical
         Attachments: 0001-ognl-avoid-double-checked-locking-anti-pattern-in-Og.patch

OgnlRuntime in OGNL 3.0.5 has several occurrences of the "double-checked locking" anti-pattern. This has already manifested in our product in the form of:

ognl.MethodFailedException: Method "xxx" failed for object yyy [java.lang.NoSuchMethodException: x.y.z.C.getFoo(java.lang.String)]

But method x.y.z.C.getFoo(String) does exist, and in fact the same OGNL expression evaluates correctly when it is tried again subsequently.

There are 11 occurrences of double-checked locking in OgnlRuntime that must be corrected. The simplest approach is to remove the unsynchronized accesses to the guarded structures. A better approach would be to use ReadWriteLocks.

--
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

        

[jira] [Commented] (OGNL-49) "Double-checked locking" anti-pattern in OgnlRuntime

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OGNL-49?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13293921#comment-13293921 ] 

Simone Tripodi commented on OGNL-49:
------------------------------------

while applying the patch, the {{patch}} command refuses 16 changes, maybe because of the {{OgnlRuntime}} class evolvement - can you please double check?
TIA,
-Simo
                
> "Double-checked locking" anti-pattern in OgnlRuntime
> ----------------------------------------------------
>
>                 Key: OGNL-49
>                 URL: https://issues.apache.org/jira/browse/OGNL-49
>             Project: Commons OGNL
>          Issue Type: Bug
>         Environment: java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
>            Reporter: Matt Whitlock
>            Assignee: Simone Tripodi
>            Priority: Critical
>         Attachments: 0001-ognl-avoid-double-checked-locking-anti-pattern-in-Og.patch
>
>
> OgnlRuntime in OGNL 3.0.5 has several occurrences of the "double-checked locking" anti-pattern. This has already manifested in our product in the form of:
> ognl.MethodFailedException: Method "xxx" failed for object yyy [java.lang.NoSuchMethodException: x.y.z.C.getFoo(java.lang.String)]
> But method x.y.z.C.getFoo(String) does exist, and in fact the same OGNL expression evaluates correctly when it is tried again subsequently.
> There are 11 occurrences of double-checked locking in OgnlRuntime that must be corrected. The simplest approach is to remove the unsynchronized accesses to the guarded structures. A better approach would be to use ReadWriteLocks.

--
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

        

[jira] [Updated] (OGNL-49) "Double-checked locking" anti-pattern in OgnlRuntime

Posted by "Matt Whitlock (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OGNL-49?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Whitlock updated OGNL-49:
------------------------------

    Attachment: 0001-ognl-avoid-double-checked-locking-anti-pattern-in-Og.patch

Here is a patch that applies the simplest possible fix.
                
> "Double-checked locking" anti-pattern in OgnlRuntime
> ----------------------------------------------------
>
>                 Key: OGNL-49
>                 URL: https://issues.apache.org/jira/browse/OGNL-49
>             Project: Commons OGNL
>          Issue Type: Bug
>         Environment: java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
>            Reporter: Matt Whitlock
>            Priority: Critical
>         Attachments: 0001-ognl-avoid-double-checked-locking-anti-pattern-in-Og.patch
>
>
> OgnlRuntime in OGNL 3.0.5 has several occurrences of the "double-checked locking" anti-pattern. This has already manifested in our product in the form of:
> ognl.MethodFailedException: Method "xxx" failed for object yyy [java.lang.NoSuchMethodException: x.y.z.C.getFoo(java.lang.String)]
> But method x.y.z.C.getFoo(String) does exist, and in fact the same OGNL expression evaluates correctly when it is tried again subsequently.
> There are 11 occurrences of double-checked locking in OgnlRuntime that must be corrected. The simplest approach is to remove the unsynchronized accesses to the guarded structures. A better approach would be to use ReadWriteLocks.

--
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

        

[jira] [Commented] (OGNL-49) "Double-checked locking" anti-pattern in OgnlRuntime

Posted by "Matt Whitlock (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OGNL-49?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295402#comment-13295402 ] 

Matt Whitlock commented on OGNL-49:
-----------------------------------

The patch was based on OGNL 3.0.5. Indeed there has been a significant reorganization in trunk since 3.0.5, so the patch no longer applies at all. Unfortunately, trunk still exhibits the double-checked locking anti-pattern. I'll submit another patch when I can get around to it.
                
> "Double-checked locking" anti-pattern in OgnlRuntime
> ----------------------------------------------------
>
>                 Key: OGNL-49
>                 URL: https://issues.apache.org/jira/browse/OGNL-49
>             Project: Commons OGNL
>          Issue Type: Bug
>         Environment: java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
>            Reporter: Matt Whitlock
>            Assignee: Simone Tripodi
>            Priority: Critical
>         Attachments: 0001-ognl-avoid-double-checked-locking-anti-pattern-in-Og.patch
>
>
> OgnlRuntime in OGNL 3.0.5 has several occurrences of the "double-checked locking" anti-pattern. This has already manifested in our product in the form of:
> ognl.MethodFailedException: Method "xxx" failed for object yyy [java.lang.NoSuchMethodException: x.y.z.C.getFoo(java.lang.String)]
> But method x.y.z.C.getFoo(String) does exist, and in fact the same OGNL expression evaluates correctly when it is tried again subsequently.
> There are 11 occurrences of double-checked locking in OgnlRuntime that must be corrected. The simplest approach is to remove the unsynchronized accesses to the guarded structures. A better approach would be to use ReadWriteLocks.

--
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