struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igor Evgrafov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4350) OgnlValueStack causes race condition
Date Wed, 21 May 2014 14:28:38 GMT

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

Igor Evgrafov commented on WW-4350:
-----------------------------------

We faced the issue on our server. All http threads got stuck in CompoundRootAccessor because
of inifinite loop in broken HashMap
{code}
"http-thread-pool-8080(17)" daemon prio=10 tid=0x00007f62cc07f800 nid=0x52f1 runnable [0x00007f62e87f0000]
   java.lang.Thread.State: RUNNABLE
	at java.util.HashMap.getEntry(HashMap.java:469)
	at java.util.HashMap.containsKey(HashMap.java:453)
	at com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.callMethod(CompoundRootAccessor.java:235)
	at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1374)
	at ognl.ASTMethod.getValueBody(ASTMethod.java:90)
	at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
	at ognl.SimpleNode.getValue(SimpleNode.java:258)
	at ognl.Ognl.getValue(Ognl.java:494)
	at ognl.Ognl.getValue(Ognl.java:458)
	at com.opensymphony.xwork2.ognl.OgnlUtil.getValue(OgnlUtil.java:251)
	at com.opensymphony.xwork2.ognl.OgnlValueStack.getValueUsingOgnl(OgnlValueStack.java:292)
	at com.opensymphony.xwork2.ognl.OgnlValueStack.tryFindValue(OgnlValueStack.java:275)
	at com.opensymphony.xwork2.ognl.OgnlValueStack.tryFindValueWhenExpressionIsNotNull(OgnlValueStack.java:257)
	at com.opensymphony.xwork2.ognl.OgnlValueStack.findValue(OgnlValueStack.java:237)
	at org.apache.struts2.components.Component.findValue(Component.java:258)
	at org.apache.struts2.components.Set.end(Set.java:104)
	at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
{code}



> OgnlValueStack causes race condition
> ------------------------------------
>
>                 Key: WW-4350
>                 URL: https://issues.apache.org/jira/browse/WW-4350
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions, Value Stack
>    Affects Versions: 2.3.16.1
>            Reporter: Sergey Gromov
>             Fix For: 2.3.18
>
>         Attachments: CompoundRootAccessor.java.patch
>
>
> _com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.callMethod_ is not thread
safe because of unsynchronized reads and writes to HashMap:
> {code}
> private static Map invalidMethods = new HashMap();
> ...
> public Object callMethod(Map context, Object target, String name, Object[] objects) throws
MethodFailedException {
>     ...
>     if ((argTypes == null) || !invalidMethods.containsKey(mc)) {
>         ...
>         invalidMethods.put(mc, Boolean.TRUE);
>         ...
>     }
>     ...
> }
> {code}
> Propose to use _ConcurrentHashMap_



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message