You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/08/14 23:42:28 UTC

[Bug 56857] New: Thread safety issue in ApplicationContextFacade.invokeMethod

https://issues.apache.org/bugzilla/show_bug.cgi?id=56857

            Bug ID: 56857
           Summary: Thread safety issue in
                    ApplicationContextFacade.invokeMethod
           Product: Tomcat 7
           Version: 7.0.52
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: vkleinschmidt@blackboard.com

Multiple subsequent Thread dumps were exhibiting lots of threads hanging in
HashMap.get() while in RUNNABLE status, and consuming high CPU - a typical
indicator of a thread safety issue with these non-threadsafe Maps.
Thread stacks all as below.

ApplicationContextFacade implements ServletContext, these objects are
singletons per webapp, and get passed around among multiple threads. Their
private member "objectCache" is a HashMap, i.e. not thread safe, but gets
accessed AND modified without any synchronization in invokeMethod().

Suggested remedy: change to a ConcurrentHashMap, which is thread-safe, and
performs much better than synchronizing on every access.

"connector-93: userId=_101_1, sessionId=C9EC1C59DD2244557BC6231A5476000E"
daemon prio=10 tid=0x00007fb1e40cf800 nid=0x7b90 runnable [0x00007fb1e82c3000]
   java.lang.Thread.State: RUNNABLE
    at java.util.HashMap.get(HashMap.java:326)
    at
org.apache.catalina.core.ApplicationContextFacade.invokeMethod(ApplicationContextFacade.java:789)
    at
org.apache.catalina.core.ApplicationContextFacade.doPrivileged(ApplicationContextFacade.java:767)
    at
org.apache.catalina.core.ApplicationContextFacade.getContextPath(ApplicationContextFacade.java:428)
    at
blackboard.portal.servlet.ModuleCustomizationServlet.service(ModuleCustomizationServlet.java:88)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
...

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56857] Thread safety issue in ApplicationContextFacade.invokeMethod

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56857

--- Comment #5 from Volker Kleinschmidt <vk...@blackboard.com> ---
Great news, thank you.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56857] Thread safety issue in ApplicationContextFacade.invokeMethod

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56857

Violeta Georgieva <vi...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Violeta Georgieva <vi...@apache.org> ---
The fix is downported in 7.0.x for 7.0.56 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56857] Thread safety issue in ApplicationContextFacade.invokeMethod

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56857

--- Comment #1 from Volker Kleinschmidt <vk...@blackboard.com> ---
As is common with thread safety issues, I have no strict replication steps.
Issue occurs sporadically, however this particular method call (getContextPath)
seems to trigger it fairly often.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56857] Thread safety issue in ApplicationContextFacade.invokeMethod

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56857

--- Comment #3 from Volker Kleinschmidt <vk...@blackboard.com> ---
Thanks for the quick follow-up. Any chance this could get backported to 7.x?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 56857] Thread safety issue in ApplicationContextFacade.invokeMethod

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56857

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Fixed in 8.0.x for 8.0.11 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org