Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronization in AnnotationMethodHandlerAdapter [SPR-7525] #12183

Closed
spring-projects-issues opened this issue Sep 3, 2010 · 5 comments
Closed
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 3, 2010

Jozef Hovan opened SPR-7525 and commented

After upgrade from Spring framework 3.0.3 to 3.0.4 our web application started to throw IndexOutOfBoundsExceptions.

SEVERE: Servlet.service() for servlet ebroker threw exception
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$RequestMappingInfo.bestMatchedPattern(AnnotationMethodHandlerAdapter.java:1017)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:613)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:422)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


Affects: 3.0.4

Issue Links:

Referenced from: commits e035477

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Indeed, due to a change in ServletHandlerMethodResolver's internal caching, we have to perform extended caching when creating those resolver instances. Fixed for 3.0.5, for the Servlet as well as for the Portlet case.

This will be available in tonight's 3.0.5 snapshot. Feel free to give it a try and check whether you cannot reproduce the issue anymore...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

dave sinclair commented

Hi Juergen,

I got the snapshot and still saw this problem. Same stack trace

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$RequestMappingInfo.bestMatchedPattern(AnnotationMethodHandlerAdapter.java:1018)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:614)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:421)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 13, 2010

Juergen Hoeller commented

As part of #10040, we did actually revisit that code once more just earlier today, exactly with respect to bestMatchedPattern storage. As a consequence, I expect this to really be fixed now - in the next 3.0.5 snapshot, coming up in a few hours. Please give it a try...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

dave sinclair commented

That did it! Thanks Juergen

dave

@spring-projects-issues
Copy link
Collaborator Author

Jozef Hovan commented

It seems ok in version 3.0.5. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants