https://bz.apache.org/bugzilla/show_bug.cgi?id=65118

            Bug ID: 65118
           Summary: Spurious null pointer exception in Http2UpgradeHandler
                    when reloading web page
           Product: Tomcat 9
           Version: 9.0.41
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: mattias.holmkv...@netinsight.net
  Target Milestone: -----

We have a web application using Tomcat configured to use HTTP/2

Sometimes (about 1 out of 10) when reloading a web page one or more resources
fails to load, typically style.css, with error connection reset reported by web
browser.

In the catalina log file the following it logged:
>27-Jan-2021 16:59:02.435 FINE [https-openssl-apr-0.0.0.0-8443-exec-2] 
>org.apache.coyote.http2.Http2UpgradeHandler.upgradeDispatch Entry, Connection 
>[2], SocketStatus [OPEN_READ]
>27-Jan-2021 16:59:02.435 FINE [https-openssl-apr-0.0.0.0-8443-exec-2] 
>org.apache.coyote.http2.Http2UpgradeHandler.init Connection [2], State 
>[CONNECTED]
>27-Jan-2021 16:59:02.436 FINE [https-openssl-apr-0.0.0.0-8443-exec-2] 
>org.apache.coyote.http2.Http2Parser.validateFrame Connection [2], Stream 
>[1019], Frame type [HEADERS], Flags [37], Payload size [44]
>27-Jan-2021 16:59:02.436 FINE [https-openssl-apr-0.0.0.0-8443-exec-2] 
>org.apache.coyote.http2.Http2UpgradeHandler.pruneClosedStreams Connection [2] 
>Starting pruning of old streams. Limit is [100] + 10% and there are currently 
>[509] streams.
>27-Jan-2021 16:59:02.436 FINE [https-openssl-apr-0.0.0.0-8443-exec-2] 
>org.apache.coyote.http2.Http2UpgradeHandler.pruneClosedStreams Connection [2] 
>Pruned completed stream [1]
>27-Jan-2021 17:00:23.798 FINE [https-openssl-apr-0.0.0.0-8443-exec-2] 
>org.apache.coyote.http2.Http2UpgradeHandler.pruneClosedStreams Connection [2] 
>Pruned completed stream [3]
>27-Jan-2021 17:00:57.370 FINE [https-openssl-apr-0.0.0.0-8443-exec-2] 
>org.apache.coyote.http2.Http2UpgradeHandler.pruneClosedStreams Connection [2] 
>Pruned completed stream [1]
>27-Jan-2021 17:01:18.505 SEVERE [https-openssl-apr-0.0.0.0-8443-exec-2] 
>org.apache.coyote.AbstractProtocol$ConnectionHandler.process Error reading 
>request, ignored
>       java.lang.NullPointerException
>               at 
> org.apache.coyote.http2.Http2UpgradeHandler.pruneClosedStreams(Http2UpgradeHandler.java:1249)
>               at 
> org.apache.coyote.http2.Http2UpgradeHandler.createRemoteStream(Http2UpgradeHandler.java:1129)
>               at 
> org.apache.coyote.http2.Http2UpgradeHandler.headersStart(Http2UpgradeHandler.java:1508)
>               at 
> org.apache.coyote.http2.Http2Parser.readHeadersFrame(Http2Parser.java:225)
>               at 
> org.apache.coyote.http2.Http2Parser.readFrame(Http2Parser.java:99)
>               at 
> org.apache.coyote.http2.Http2Parser.readFrame(Http2Parser.java:71)
>               at 
> org.apache.coyote.http2.Http2UpgradeHandler.upgradeDispatch(Http2UpgradeHandler.java:339)
>               at 
> org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60)
>               at 
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:59)
>               at 
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888)
>               at 
> org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:1991)
>               at 
> org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
>               at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>               at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>               at 
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>               at java.lang.Thread.run(Thread.java:748)

We see this with multiple web browsers including Chrome (88.0.4324.104) and
Firefox (84.0.2)

Tomcat is configured to use HTTP/2 with default values.

In order to reproduce this issue we continuously reload a web page until issue
occurs.

After examining the logs and the code (Http2UpgradeHandler.java:1249) it seems
to me that the same stream is pruned twice, in the same go, and the second time
its parent is already removed resulting in a NPE due to variable parent is
null.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to