Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.26.Final
    • Fix Version/s: 2.2.1.Final
    • Component/s: Servlet
    • Labels:
      None
    • Estimated Difficulty:
      Low

      Description

      In a scenario of writing header (16K+ of size) to servlet's response output stream, I am wondering if it would be better to get IOException instead of BufferOverflowException (which is RuntimeException):

      java.nio.BufferOverflowException
      	at java.base/java.nio.Buffer.nextPutIndex(Unknown Source)
      	at java.base/java.nio.DirectByteBuffer.put(Unknown Source)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.protocol.ajp.AjpServerResponseConduit.putString(AjpServerResponseConduit.java:156)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.protocol.ajp.AjpServerResponseConduit.processAJPHeader(AjpServerResponseConduit.java:239)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.protocol.ajp.AjpServerResponseConduit.write(AjpServerResponseConduit.java:289)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.protocol.ajp.AjpServerResponseConduit.write(AjpServerResponseConduit.java:369)
      	at org.jboss.xnio@3.7.3.Final//org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:158)
      	at io.undertow.core@2.0.26.Final//io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:179)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.HttpServerExchange$WriteDispatchChannel.write(HttpServerExchange.java:2070)
      	at org.jboss.xnio@3.7.3.Final//org.xnio.channels.Channels.writeBlocking(Channels.java:152)
      	at io.undertow.servlet@2.0.26.Final//io.undertow.servlet.spec.ServletOutputStreamImpl.writeTooLargeForBuffer(ServletOutputStreamImpl.java:198)
      	at io.undertow.servlet@2.0.26.Final//io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:146)
      	at io.undertow.servlet@2.0.26.Final//io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:129)
      	at com.compuware.apm.agent.introspection.uem.jsagent.HtmlInjectionBuilder.inject(HtmlInjectionBuilder.java:369)
      	at javax.servlet.api@2.0.0.Final//com.compuware.apm.agent.introspection.uem.impl.AutoHtmlInjectorStream.write(AutoHtmlInjectorStream.java:130)
      	at java.base/java.io.OutputStream.write(Unknown Source)
      

      And then the same when trying to close the stream quietly:

      java.nio.BufferOverflowException
      	at java.base/java.nio.Buffer.nextPutIndex(Unknown Source)
      	at java.base/java.nio.DirectByteBuffer.put(Unknown Source)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.protocol.ajp.AjpServerResponseConduit.putString(AjpServerResponseConduit.java:156)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.protocol.ajp.AjpServerResponseConduit.processAJPHeader(AjpServerResponseConduit.java:239)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.protocol.ajp.AjpServerResponseConduit.write(AjpServerResponseConduit.java:289)
      	at org.jboss.xnio@3.7.3.Final//org.xnio.conduits.Conduits.writeFinalBasic(Conduits.java:132)
      	at io.undertow.core@2.0.26.Final//io.undertow.conduits.AbstractFramedStreamSinkConduit.writeFinal(AbstractFramedStreamSinkConduit.java:113)
      	at org.jboss.xnio@3.7.3.Final//org.xnio.conduits.ConduitStreamSinkChannel.writeFinal(ConduitStreamSinkChannel.java:104)
      	at io.undertow.core@2.0.26.Final//io.undertow.channels.DetachableStreamSinkChannel.writeFinal(DetachableStreamSinkChannel.java:195)
      	at io.undertow.core@2.0.26.Final//io.undertow.server.HttpServerExchange$WriteDispatchChannel.writeFinal(HttpServerExchange.java:2084)
      	at io.undertow.servlet@2.0.26.Final//io.undertow.servlet.spec.ServletOutputStreamImpl.writeBufferBlocking(ServletOutputStreamImpl.java:572)
      	at io.undertow.servlet@2.0.26.Final//io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:609)
      	at javax.servlet.api@2.0.0.Final//com.compuware.apm.agent.introspection.uem.impl.AgentInjectingServletOutputStream.close(AgentInjectingServletOutputStream.java:186)
      	at javax.servlet.api@2.0.0.Final//com.compuware.apm.agent.introspection.uem.impl.AutoHtmlInjectorStream.close(AutoHtmlInjectorStream.java:261)
      

      Another point for improvement could be having a validation or exception message pointing out that header value is larger than the limit.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                flavia.rainone Flavia Rainone
                Reporter:
                rady66 Radoslav Ivanov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: