Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1021

AJP listener should log at DEBUG level when handling 400 Bad Request like wrong magic number and invalid Content-Length

XMLWordPrintable

      The following ERROR log message is shown when ajp-listener handles other protocol than AJP. For example, sending HTTP request agasint AJP port like "curl -v http://localhost:8009":

      ERROR [io.undertow.request] (default I/O-46) UT005001: An exception occurred processing the request: java.io.IOException: UT000066: Incorrect magic number 18245 for AJP packet header
      	at io.undertow.server.protocol.ajp.AjpRequestParser.parse(AjpRequestParser.java:189)
      	at io.undertow.server.protocol.ajp.AjpReadListener.handleEvent(AjpReadListener.java:166)
      	at io.undertow.server.protocol.ajp.AjpOpenListener.handleEvent(AjpOpenListener.java:131)
      	at io.undertow.server.protocol.ajp.AjpOpenListener.handleEvent(AjpOpenListener.java:51)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
      	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:129)
      	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:588)
      	at org.xnio.nio.WorkerThread.run(WorkerThread.java:468)
      

      The following ERROR log message is shown when ajp-listener receives invalid Content-Length. For example, "Content-Length: a". (Note: Most of front-end loadbalancer reject such invalid Content-Length before forwarding to a backend server. But, as far as I tested, mod_proxy forwards the request and causes this ERROR log.)

      ERROR [io.undertow.request] (default I/O-14) UT005001: An exception occurred processing the request: java.lang.NumberFormatException: For input string: "a"
      	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      	at java.lang.Long.parseLong(Long.java:589)
      	at java.lang.Long.parseLong(Long.java:631)
      	at io.undertow.server.protocol.ajp.AjpReadListener.createSourceConduit(AjpReadListener.java:319)
      	at io.undertow.server.protocol.ajp.AjpReadListener.handleEvent(AjpReadListener.java:212)
      	at io.undertow.server.protocol.ajp.AjpOpenListener.handleEvent(AjpOpenListener.java:131)
      	at io.undertow.server.protocol.ajp.AjpOpenListener.handleEvent(AjpOpenListener.java:51)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)
      	at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)
      	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
      	at org.xnio.nio.QueuedNioTcpServer$1.run(QueuedNioTcpServer.java:129)
      	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:588)
      	at org.xnio.nio.WorkerThread.run(WorkerThread.java:468)
      

      The above should be treated as "400 Bad Request", so undertow should log at DEBUG level to avoid filling the logs.

            sdouglas1@redhat.com Stuart Douglas
            rhn-support-mmiura Masafumi Miura
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: