Details
-
Bug
-
Resolution: Done
-
Major
-
2.0.26.Final
Description
NullPointerException can happen on the range request for a static content. This happens if the following conditions are met:
- A size of Range request is larger than the buffer size (16 KiB = 16384 Bytes by default)
- IOException (DEBUG level logging on io.undertow.request.io) occurs during sending the last part of the range response
(for example, a client browser close the connection or a front-end proxy closed the connection due to timeout)
ERROR [io.undertow.request] (default task-1) UT005071: Undertow request failed HttpServerExchange{ GET /test.txt}: java.lang.NullPointerException at io.undertow.server.handlers.resource.PathResource$1ServerTask.run(PathResource.java:156) at io.undertow.server.handlers.resource.PathResource$1ServerTask.onComplete(PathResource.java:200) at io.undertow.io.AsyncSenderImpl.invokeOnComplete(AsyncSenderImpl.java:413) at io.undertow.io.AsyncSenderImpl.send(AsyncSenderImpl.java:173) at io.undertow.server.handlers.resource.PathResource$1ServerTask.run(PathResource.java:187) at io.undertow.server.handlers.resource.PathResource.serveImpl(PathResource.java:256) at io.undertow.server.handlers.resource.PathResource.serveRange(PathResource.java:118) at io.undertow.server.handlers.resource.ResourceHandler$1.handleRequest(ResourceHandler.java:335) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1349) at java.lang.Thread.run(Thread.java:748)
It seems this NPE is harmless because the connection is already closed and no bad side effects happen to the response anymore. However, of course, it's better to avoid NPE.
Attachments
Issue Links
- is cloned by
-
JBEAP-17859 [GSS](7.3.z) UNDERTOW-1595 - NullPointerException can happen on a range request for a static content
- Verified
- is related to
-
UNDERTOW-1717 Return 416 Range Not Satisfiable when first-byte-pos of Range request header is equal to the content-length
- Resolved