Improved error message for InvocationTarget/NullPointerExceptions related to terminated requests
- Dominant language
- Scala
- Stars
- 1.3k
- Forks
- 275
- PR merge metrics
- No merged PRs in 30d
Description
Investigations with different servlet containers under load indicate that suspended continuations may be awoken with terminated requests. This yields either null server names/ports (typically in Jetty 6) or InvocationTargetExceptions (in Jetty 7/8 and Tomcat) with underlying IllegalStateExceptions.
Sample stack trace from Tomcat:
java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_26]
at net.liftweb.http.provider.servlet.containers.Servlet30AsyncProvider.resume(Servlet30AsyncProvider.scala:102) ~[lift-webkit_2.8.1-2.4-M4.jar:2.4-M4]
[…]
Caused by: java.lang.IllegalStateException: The request associated with the AsyncContext has already completed processing.
at org.apache.catalina.core.AsyncContextImpl.check(AsyncContextImpl.java:438) ~[catalina.jar:7.0.23]
at org.apache.catalina.core.AsyncContextImpl.getResponse(AsyncContextImpl.java:196) ~[catalina.jar:7.0.23]
... 22 common frames omitted
From Jetty 7/8:
java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_26]
at net.liftweb.http.provider.servlet.containers.Servlet30AsyncProvider.resume(Servlet30AsyncProvider.scala:106) ~[lift-webkit_2.8.1-2.4-M4.jar:2.4-M4]
at net.liftweb.http.provider.servlet.HTTPRequestServlet.resume(HTTPRequestServlet.scala:163) ~[lift-webkit_2.8.1-2.4-M4.jar:2.4-M4]
[…]
Caused by: java.lang.IllegalStateException: IDLE,initial
at org.eclipse.jetty.server.AsyncContinuation.complete(AsyncContinuation.java:534) ~[na:na]
... 22 common frames omitted
From Jetty 6:
java.lang.NullPointerException: null
at org.eclipse.jetty.server.Request.getServerName(Request.java:1008) ~[na:na]
at org.eclipse.jetty.server.Request.getServerPort(Request.java:1071) ~[na:na]
at net.liftweb.http.provider.servlet.HTTPRequestServlet.serverPort(HTTPRequestServlet.scala:92) ~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.Req$$anonfun$hostAndPath$1.apply(Req.scala:968) ~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.Req$$anonfun$hostAndPath$1.apply(Req.scala:968) ~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.common.Full.map(Box.scala:491) ~[lift-common_2.9.0-1-2.4-M3.jar:2.4-M3]
at net.liftweb.http.Req.hostAndPath(Req.scala:968) ~[lift-webkit_2.9.0-1-2.4-M3.jar:2.4-M3]
Again, the underlying cause for this seems to be continuations that are awoken with requests that were terminated before the continuation was restored.
Contributor guide
Assessment
This issue has not been assessed yet.