Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.4
-
None
-
R2+, R3
Description
When we are doing the performace testing. we simulate high pressure of concurrent requests to invoke soap service. severals hours later, CPU will be 100% and can not be released when the pressure is stopped.
We check the stack log and have found several threads are locked at
java.util.WeakHashMap.getEntry(WeakHashMap.java:375)
java.util.WeakHashMap.containsKey(WeakHashMap.java:361)
org.apache.axis.handlers.soap.SOAPService.addSession(SOAPService.java:125)
org.apache.axis.providers.java.JavaProvider.getSessionServiceObject(JavaProvider.java:185)
org.apache.axis.providers.java.JavaProvider.getServiceObject(JavaProvider.java:100)
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:287)
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:700)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
Because WeakHashMap is not safe within concurrent threads so I doubt maybe there is a problem. I modify the method: addSession of SOAPService.java (org.apache.axis.handlers.soap)
add the 'synchronized ':
synchronized (map)
{
if (!(map.containsKey(session)))
}
Then the cpu problem does not occur.