Issue 1:
Hans Westerbeek opened SPR-4335 and commented

This issue is identical to: http://jira.springframework.org/browse/SPR-4235 except the fix has not been propagated to portlet-mvc.

The problem finally affects the user by making it impossible to let SimpleMappingingExceptionResolver map the configurated error view. Instead it falls back to the default error view.

Stacktrace:

2008-01-15 10:18:24,646 WARN [org.springframework.web.portlet.DispatcherPortlet] - <Handler execution resulted in exception - forwarding to resolved error view>

java.lang.IllegalStateException: Unexpected exception thrown

at org.springframework.util.ReflectionUtils.handleUnexpectedException(ReflectionUtils.java:290)

at org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:260)

at org.springframework.util.ReflectionUtils.handleInvocationTargetException(ReflectionUtils.java:239)

at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.doHandle(AnnotationMethodHandlerAdapter.java:233)

at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.handleAction(AnnotationMethodHandlerAdapter.java:148)

at org.springframework.web.portlet.DispatcherPortlet.doActionService(DispatcherPortlet.java:694)

at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:484)

at org.springframework.web.portlet.FrameworkPortlet.processAction(FrameworkPortlet.java:466)

at org.apache.pluto.core.PortletServlet.dispatch(PortletServlet.java:218)

at org.apache.pluto.core.PortletServlet.doGet(PortletServlet.java:139)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)

at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)

at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)

at org.apache.pluto.core.DefaultPortletInvokerService.invoke(DefaultPortletInvokerService.java:167)

at org.apache.pluto.core.DefaultPortletInvokerService.action(DefaultPortletInvokerService.java:85)

at org.apache.pluto.core.PortletContainerImpl.doAction(PortletContainerImpl.java:219)

at org.apache.pluto.driver.PortalDriverServlet.doGet(PortalDriverServlet.java:112)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:419)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:619)

Caused by: nl.neteffect.dtg.datafabriek.service.NoMoreContactsLeftException

at nl.neteffect.dtg.datafabriek.service.CustomerServiceImpl.popContact(CustomerServiceImpl.java:199)

at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)

at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:70)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

at $Proxy18.popContact(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:205)

at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)

at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)

at org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocationBasedExporter.java:114)

at org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.handleRequest(HttpInvokerServiceExporter.java:74)

at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:808)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)

at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)

at java.lang.Thread.run(Thread.java:619)

at org.springframework.remoting.support.RemoteInvocationUtils.fillInClientStackTraceIfPossible(RemoteInvocationUtils.java:47)

at org.springframework.remoting.support.RemoteInvocationResult.recreate(RemoteInvocationResult.java:115)

at org.springframework.remoting.support.RemoteInvocationBasedAccessor.recreateRemoteInvocationResult(RemoteInvocationBasedAccessor.java:85)

at org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.invoke(HttpInvokerClientInterceptor.java:163)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

at $Proxy4.popContact(Unknown Source)

at nl.neteffect.dtg.promopages.backend.controller.DataEntryController.selectContact(DataEntryController.java:115)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.doHandle(AnnotationMethodHandlerAdapter.java:230)

... 35 more

Affects: 2.5.1

Issue Links:

#8913 [AnnotationMethodHandlerAdapter] Improve handling of InvocationTargetExceptions ("duplicates")

Issue 2:
Johannes Tuchscherer opened SPR-8319 and commented

When there are a lot of requests hitting a request method with parameter annotations we occasionally get a deadlock in the jvm (see below for stack trace). I think this could be easily fixed in the org.springframework.core.HandlerMethodInvoker, if - instead of creating a new instance of MethodParameter every time (line 243) - the methodParameters and their annotations would be cached. This would also give us a nice performance gain, since we don't need to lookup annotations every time the request method is called.

java.lang.Thread.State: BLOCKED (on object monitor)

at java.lang.reflect.Proxy.getProxyClass(Proxy.java:417) - waiting to lock <0x00000000ac1166d0> (a java.util.HashMap)

at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)

at sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:239)

at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:229)

at sun.reflect.annotation.AnnotationParser.parseParameterAnnotations2(AnnotationParser.java:133)

at sun.reflect.annotation.AnnotationParser.parseParameterAnnotations(AnnotationParser.java:110)

at java.lang.reflect.Method.getParameterAnnotations(Method.java:751)

at org.springframework.core.MethodParameter.getParameterAnnotations(MethodParameter.java:232)

at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:246)

at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:169)

at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)

at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

Blocked by:

java.lang.Thread.State: BLOCKED (on object monitor)

at java.util.AbstractList.iterator(AbstractList.java:273)

at java.util.AbstractList.hashCode(AbstractList.java:524)

at java.util.HashMap.get(HashMap.java:300)

at java.lang.reflect.Proxy.getProxyClass(Proxy.java:426) - locked <0x00000000ac1166d0> (a java.util.HashMap)

at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)

at sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:239)

at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:229)

at sun.reflect.annotation.AnnotationParser.parseParameterAnnotations2(AnnotationParser.java:133)

at sun.reflect.annotation.AnnotationParser.parseParameterAnnotations(AnnotationParser.java:110)

at java.lang.reflect.Method.getParameterAnnotations(Method.java:751)

at org.springframework.core.MethodParameter.getParameterAnnotations(MethodParameter.java:232)

at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java:246)

at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:169)

at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)

at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

Affects: 3.0.2

Issue Links:

#13936 monitor contention at org.springframework.core.MethodParameter.getParameterAnnotations() ("duplicates")

#14429 Develop ConcurrentReferenceHashMap

1 votes, 2 watchers