Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-5119

Blocking Threads in retrieving text from resource bundle

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5.26
    • 2.5.27, 2.6
    • Core Tags
    • None

    Description

      Hi,

      I am running load tests with an application based on Apache Struts 2.5.26 and Spring Framework. In the thread dumps I took during the load tests, there are many many threads with stacktraces that tell me there is a synchronization in com.opensymphony.xwork2.TextProviderSupport.getText which blocks all other threads.

       

      The jsp tag leading to that is for example:

       

      <s:set var="variablename" value="getText('topic.find.value.field.name')"/>

       

      The stack trace is then:

       "http-nio-8080-exec-69" #144 daemon prio=5 os_prio=0 tid=0x0000000027b84000 nid=0x1ca4 waiting for monitor entry [0x000000003939b000]"http-nio-8080-exec-69" #144 daemon prio=5 os_prio=0 tid=0x0000000027b84000 nid=0x1ca4 waiting for monitor entry [0x000000002937b000]   java.lang.Thread.State: BLOCKED (on object monitor) at java.util.Collections$SynchronizedCollection.contains(Collections.java:2021) - locked <0x00000009d3b1b8f0> (a java.util.Collections$SynchronizedSet) at com.opensymphony.xwork2.util.AbstractLocalizedTextProvider.findResourceBundle(AbstractLocalizedTextProvider.java:393) at com.opensymphony.xwork2.util.StrutsLocalizedTextProvider.findResourceBundle(StrutsLocalizedTextProvider.java:39) at com.opensymphony.xwork2.util.AbstractLocalizedTextProvider.getMessage(AbstractLocalizedTextProvider.java:500) at com.opensymphony.xwork2.util.AbstractLocalizedTextProvider.findMessage(AbstractLocalizedTextProvider.java:537) at com.opensymphony.xwork2.util.AbstractLocalizedTextProvider.findMessage(AbstractLocalizedTextProvider.java:583) at com.opensymphony.xwork2.util.StrutsLocalizedTextProvider.findText(StrutsLocalizedTextProvider.java:244) at com.opensymphony.xwork2.util.StrutsLocalizedTextProvider.findText(StrutsLocalizedTextProvider.java:166) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:212) at com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:127) at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:91) at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at ognl.OgnlRuntime.invokeMethodInsideSandbox(OgnlRuntime.java:1266) at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:1251) at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1969) at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68) at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:98) at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:83) at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:2045) at com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.callMethod(CompoundRootAccessor.java:237) at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:2045) at ognl.ASTMethod.getValueBody(ASTMethod.java:97) at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212) at ognl.SimpleNode.getValue(SimpleNode.java:258) at ognl.Ognl.getValue(Ognl.java:537) at ognl.Ognl.getValue(Ognl.java:501) at com.opensymphony.xwork2.ognl.OgnlUtil$2.execute(OgnlUtil.java:484) at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute(OgnlUtil.java:523) at com.opensymphony.xwork2.ognl.OgnlUtil.getValue(OgnlUtil.java:482) at com.opensymphony.xwork2.ognl.OgnlValueStack.getValueUsingOgnl(OgnlValueStack.java:296) at com.opensymphony.xwork2.ognl.OgnlValueStack.tryFindValue(OgnlValueStack.java:279) at com.opensymphony.xwork2.ognl.OgnlValueStack.tryFindValueWhenExpressionIsNotNull(OgnlValueStack.java:261) at com.opensymphony.xwork2.ognl.OgnlValueStack.findValue(OgnlValueStack.java:241) at org.apache.struts2.components.Component.findValue(Component.java:275) at org.apache.struts2.components.Set.end(Set.java:102) at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:39)

      Is it really needed to put this kind of synchronization there, which causes thread contention? Would for example a ConcurrentHashMap be possible?

      Attachments

        1. WW-5119.jmx
          15 kB
          Tobias Barth
        2. ww5119.zip
          61 kB
          Tobias Barth
        3. ww-5119-threaddump.txt
          932 kB
          Tobias Barth

        Activity

          People

            Unassigned Unassigned
            tbf4000 Tobias Barth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 20m
                2h 20m