Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-30724

[GSS](8.1.z) UNDERTOW-2576 - ProxyHandler can throw NullPointerException if the source address SocketAddress has no ip address

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.1 Update 2
    • 8.0 Update 7
    • Undertow
    • None

      After UNDERTOW-2046, the following NPE could be seen in a less likely scenario if the source address returns no actual ip address:

      java.lang.NullPointerException: Cannot invoke "java.net.InetAddress.getHostAddress()" because the return value of "java.net.InetSocketAddress.getAddress()" is null
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.handlers.proxy.ProxyHandler$ProxyAction.run(ProxyHandler.java:482)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.util.SameThreadExecutor.execute(SameThreadExecutor.java:35)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.HttpServerExchange.dispatch(HttpServerExchange.java:874)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.handlers.proxy.ProxyHandler$ProxyClientHandler.completed(ProxyHandler.java:345)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.handlers.proxy.ProxyHandler$ProxyClientHandler.completed(ProxyHandler.java:319)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.handlers.proxy.ProxyConnectionPool.connectionReady(ProxyConnectionPool.java:353)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.handlers.proxy.ProxyConnectionPool.connect(ProxyConnectionPool.java:548)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.handlers.proxy.mod_cluster.Context.handleRequest(Context.java:179)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.handlers.proxy.mod_cluster.ModClusterProxyClient.getConnection(ModClusterProxyClient.java:124)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.handlers.proxy.ProxyHandler$ProxyClientHandler.run(ProxyHandler.java:339)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.util.SameThreadExecutor.execute(SameThreadExecutor.java:35)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.Connectors.executeRootHandler(Connectors.java:412)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:265)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100)
      at io.undertow.core@2.2.37.SP2-redhat-00001//io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57)
      at org.jboss.xnio@3.8.16.Final-redhat-00001//org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

      A possible scenario could be with a ProxyPeerAddressHandler also in use and then if Undertow receives a hostname in the X-Forwarded-For.  An unresolved host is then set on the source address for a later NPE.

              rhn-support-aogburn Aaron Ogburn
              rhn-support-aogburn Aaron Ogburn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: