Uploaded image for project: 'Stripes'
  1. STS-926

Concurrent access to not synchronized HashMap

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: Release 1.5.7
    • Fix Version/s: None
    • Component/s: ActionBean Dispatching
    • Labels:
      None
    • Sprint:

      Description

      We use stripes for a long time but today several threads hung with such stack-trace:

      Thread[a STR HTTP-XXX.action?,5,main] class org.apache.tomcat.util.threads.TaskThread 
      java.util.HashMap.getEntry(HashMap.java:446) 
      java.util.HashMap.containsKey(HashMap.java:434)
      net.sourceforge.stripes.controller.BindingPolicyManager.getInstance(BindingPolicyManager.java:81)
      net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.isBindingAllowed(DefaultActionBeanPropertyBinder.java:256)
      net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.bind(DefaultActionBeanPropertyBinder.java:153)
      net.sourceforge.stripes.controller.DispatcherHelper$3.intercept(DispatcherHelper.java:218)
      net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
      net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
      net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
      net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
      net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:214)
      net.sourceforge.stripes.controller.DispatcherServlet.doBindingAndValidation(DispatcherServlet.java:254)
      net.sourceforge.stripes.controller.DispatcherServlet.service(DispatcherServlet.java:148)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      

      AFAIK, that is how not-synchronized java hash map react to concurrent modification.

      Possible solutions include update HashMap to ConcurrentHashMap, use of Collections.synchronizedMap(), put synchronized keyword to BindingPolicyManager.getInstance().

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              andrei.sobchuck Andrei
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: