我在Web应用程序中不时地处理GET请求(例如每月一次)时遇到此异常。堆栈跟踪永远不会触及我的代码,甚至Grails'。我无法弄清楚如何重现它,但它似乎总是在前几次请求中发生。
我正在使用Grails v3.3.1。
堆栈跟踪的第二行位于Maven coords:org.springframework:spring-core:4.3.9.RELEASE
查看Spring的源代码,我无法在引用行(63)或类(LocalVariableTPND
)中调用ArrayList.add()
的位置找到。很奇怪......有什么想法吗?
显然我无法启用调试,因为它是非常罕见的情况。
java.lang.ArrayIndexOutOfBoundsException: 15
at java.util.ArrayList.add(ArrayList.java:463)
at org.springframework.core.LocalVariableTableParameterNameDiscoverer.<init>(LocalVariableTableParameterNameDiscoverer.java:63)
at org.springframework.core.DefaultParameterNameDiscoverer.<init>(DefaultParameterNameDiscoverer.java:44)
at org.springframework.web.method.support.InvocableHandlerMethod.<init>(InvocableHandlerMethod.java:54)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.<init>(ServletInvocableHandlerMethod.java:74)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.createInvocableHandlerMethod(RequestMappingHandlerAdapter.java:846)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:797)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
修改
这是处理请求的处理程序方法的来源。与缓存相关的方法由:org.grails.plugins:cache-headers:2.0.2
@GrailsCompileStatic(TypeCheckingMode.SKIP)
def read() {
Organization organization = organizationService.forId(response, params.organizationId as Long)
if (organization == null) return
Appeal appeal = appealService.forId(response, organization, params.appealId as Long)
if (appeal == null) return
MessageDigest messageDigest = MessageDigest.getInstance("SHA1")
messageDigest.update(Utils.longToBytes(appeal.version))
String sha1Hex = new BigInteger(1, messageDigest.digest()).toString(16).padLeft(40, '0')
withCacheHeaders {
etag {
sha1Hex
}
generate {
// response
response.status = SC_OK
respond([appeal: appeal])
}
}
}
编辑2: 我能够再次两次意外地重现这一点。相同的堆栈跟踪,但它抱怨的索引不同。第一次,我像以前一样得到了15。但第二次(在相同的应用程序实例中)是109。