Hello,

today I got feedback from users, that pages are sometimes not shown.
After pressing F5 the website shows up again.
So this error also has effects on client side.

I am not sure if it is related to Tomcat 10 Upgrade. At least I don’t see that 
error in the Tomcat 9 logfiles.
After switching to Tomcat 10, many errors show up each day in the 
localhost-logfile.

Did anything change in http2-protocol in Tomcat 10 ?
Any ideas how to narrow down the problem?

Greetings,
Thomas

-----Ursprüngliche Nachricht-----
Gesendet: Montag, 7. März 2022 14:26
An: Tomcat Users List <users@tomcat.apache.org>
Betreff: Many IllegalStateException when using http2 protocol

Hello,

Since upgrading from Tomcat 9.0.56 to Tomcat 10.0.16, the localhost-logfile is 
filling up with stacks of the form:

07-Mar-2022 07:24:01.780 SCHWERWIEGEND [https-openssl-nio-443-exec-21] 
org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for 
servlet [jsp] threw exception
        java.lang.IllegalStateException: Connection [66], Stream [113], Unable 
to write to stream once it has been closed
                at 
org.apache.coyote.http2.Stream$StreamOutputBuffer.doWrite(Stream.java:843)
                at 
org.apache.coyote.http11.filters.GzipOutputFilter$FakeOutputStream.write(GzipOutputFilter.java:159)
                at 
java.base/java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:252)
                at 
java.base/java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:210)
                at 
java.base/java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:148)
                at 
org.apache.coyote.http11.filters.GzipOutputFilter.doWrite(GzipOutputFilter.java:69)
                at 
org.apache.coyote.http2.Http2OutputBuffer.doWrite(Http2OutputBuffer.java:59)
                at org.apache.coyote.Response.doWrite(Response.java:625)
                at 
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:340)
                at 
org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:783)
                at 
org.apache.catalina.connector.OutputBuffer.realWriteChars(OutputBuffer.java:453)
                at 
org.apache.catalina.connector.OutputBuffer.flushCharBuffer(OutputBuffer.java:788)
                at 
org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:727)
                at 
org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:505)
                at 
org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:148)
                at 
org.apache.catalina.filters.ExpiresFilter$XPrintWriter.write(ExpiresFilter.java:850)
                at 
org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:275)
                at java.base/java.io.PrintWriter.write(PrintWriter.java:506)
                at 
org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:275)
                at java.base/java.io.PrintWriter.write(PrintWriter.java:506)
                at 
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:112)
                at 
org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:160)
                at 
org.apache.jsp.WEB_002dINF.jsp.businessrelations.ticket_005frelations_inc_jsp._jspService(ticket_005frelations_inc_jsp.java:702)
                ...

The jsp-file varies between the stacktraces, so it is not related to a certain 
jsp-File.
The stream.java looks like (which didn’t change from Tomcat 9 to 10):
        @Override
        public final synchronized int doWrite(ByteBuffer chunk) throws 
IOException {
            if (closed) {
                throw new IllegalStateException(
                        sm.getString("stream.closed", getConnectionId(), 
getIdAsString()));
            }

The generated java file from the jsp file only catches IOException:
...
      if (!(t instanceof jakarta.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              out.clearBuffer();
            }
          } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) 
_jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }

It seems like the browser is sometimes closing the stream and this causes 
Tomcat to write exceptions in the localhost-logfile.

Is there any way to prevent this?
It is strange, that it didn’t happen with Tomcat 9 or maybe a Firefox-Update is 
causing the issue(?) Access-log shows Firefox 97.

Greetings, Thomas
B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[
�\�\��][��X��ܚX�P�X�]
�\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[
�\�\��Z[�X�]
�\X�K�ܙ�B�

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to