4

Recently we started supporting HTTP2 for our servers. We have used the below configuration for upgrading the HTTP2 protocol. The build started without an error. But we are facing a critical issue after running the server that is, some of the requests are moved to 302 status code from the server. And I didn't find any exception in catalina.out file.

Configuration:

<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
     SSLEnabled="true" acceptCount="1000" maxSpareThreads="75" maxThreads="500" 
     minSpareThreads="25" compression="on" >
      <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" 
       compression="on" />
      <SSLHostConfig honorCipherOrder="false">
        <Certificate certificateKeyFile="conf/server.key" certificateFile="conf/server.crt"/>
      </SSLHostConfig>
    </Connector>

There are some clues in the localhost_ log file. A NullPointerException was found in .invoke method. Only these requests are moved to 302 status code.

==> localhost.2019-10-24.log <==
24-Oct-2019 03:32:16.106 SEVERE [https-openssl-apr-8443-exec-16] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [default] in context with path [] threw exception
java.lang.NullPointerException
24-Oct-2019 03:32:16.843 SEVERE [https-openssl-apr-8443-exec-14] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [default] in context with path [] threw exception
java.lang.NullPointerException
==> localhost_access_log.2019-10-24.txt <==
121.244.91.22 - - [24/Oct/2019:03:32:12 -0700] POST /app/get_notification_count HTTP/2.0 200 73
121.244.91.21 - - [24/Oct/2019:03:32:14 -0700] POST /app/get_all_tag_details HTTP/2.0 200 4401
121.244.91.20 - - [24/Oct/2019:03:32:15 -0700] POST /app/get_notification_count HTTP/2.0 200 72
121.244.91.21 - - [24/Oct/2019:03:32:16 -0700] POST /app/get_notification_count HTTP/2.0 302 -
117.239.106.136 - - [24/Oct/2019:03:32:16 -0700] POST /app/get_notification_count HTTP/2.0 200 73
121.244.91.21 - - [24/Oct/2019:03:32:16 -0700] POST /app/get_notification_count HTTP/2.0 302 -
121.244.91.21 - - [24/Oct/2019:03:32:17 -0700] POST /app/get_all_user_details HTTP/2.0 200 1149
121.244.91.21 - - [24/Oct/2019:03:32:17 -0700] GET /app HTTP/2.0 200 2512

When I switch to other networks, it works (status code 200) without an error. I am totally confused about this scenario. The issue cannot be reproduced after restart the tomcat server.

Tomcat version: > 9

I would greatly appreciate it if you could help me with this.

sprabhakaran
  • 1,615
  • 5
  • 20
  • 36
  • [1] What do you mean by _"switch to other networks"_? Do you mean using a server which is running Tomcat 8.5.x instead of Tomcat 9.x? If not, can you clarify? [2] Do you only get 302 for `POST /app/get_notification_count`, or does it also occur for other requests sometimes? – skomisa Oct 29 '19 at 05:01
  • [1] - "switch to other networks" - I mean that the wifi networks( we have corp network and guest network in our office, req will be worked on the guest network). [2] - I get 302 for particularly get_notification_cout request only. – sprabhakaran Oct 29 '19 at 08:53
  • OK. [1] Do you have stack traces in any log for those `NullPointerException`s? [2] Have you tried running with `compression="off"` for `` to see if the 302 goes away? (To be clear, I have no reason to think that will solve your problem, but it is a simple thing to try.) – skomisa Oct 29 '19 at 18:56
  • No, there is none of the trace found in the log file. I am curious to know why I need to set compression as "off" for UpgradeProtocol? – sprabhakaran Oct 30 '19 at 10:42

0 Answers0