0 Replies Latest reply on Feb 14, 2020 3:05 PM by bobkirby

    Servlet path match failed should never happen

    bobkirby Newbie

      About once a day, Wildfly outputs within Eclipse 2019-09 R (4.13.0):

      08:12:27,671 ERROR [io.undertow.request] (default I/O-1) UT005071: Undertow request failed HttpServerExchange{ CONNECT ip.ws.126.net:443}: java.lang.IllegalArgumentException: UT000068: Servlet path match failed

          at io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletPathMatchesData.getServletHandlerByPath(ServletPathMatchesData.java:83)

          at io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:88)

          at io.undertow.servlet@2.0.21.Final//io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:151)

          at io.undertow.core@2.0.21.Final//io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65)

          at io.undertow.core@2.0.21.Final//io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:91)

          at org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.Host$OptionsHandler.handleRequest(Host.java:399)

          at io.undertow.core@2.0.21.Final//io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65)

          at org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.Host$AcmeResourceHandler.handleRequest(Host.java:421)

          at org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.Host$HostRootHandler.handleRequest(Host.java:430)

          at io.undertow.core@2.0.21.Final//io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:64)

          at io.undertow.core@2.0.21.Final//io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:78)

          at io.undertow.core@2.0.21.Final//io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49)

          at org.wildfly.extension.undertow@17.0.1.Final//org.wildfly.extension.undertow.Server$DefaultHostHandler.handleRequest(Server.java:190)

          at io.undertow.core@2.0.21.Final//io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:211)

          at io.undertow.core@2.0.21.Final//io.undertow.server.protocol.http2.Http2UpgradeHandler.handleRequest(Http2UpgradeHandler.java:102)

          at io.undertow.core@2.0.21.Final//io.undertow.server.handlers.DisallowedMethodsHandler.handleRequest(DisallowedMethodsHandler.java:61)

          at io.undertow.core@2.0.21.Final//io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)

          at io.undertow.core@2.0.21.Final//io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255)

          at io.undertow.core@2.0.21.Final//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)

          at io.undertow.core@2.0.21.Final//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:59)

          at org.jboss.xnio@3.7.2.Final//org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

          at org.jboss.xnio@3.7.2.Final//org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)

          at org.jboss.xnio.nio@3.7.2.Final//org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)

          at org.jboss.xnio.nio@3.7.2.Final//org.xnio.nio.WorkerThread.run(WorkerThread.java:591)

       

      In order to learn about Wildfly with a stable build, the version is wildfly-17.0.1.Final rather than a later build.

      The site ip.ws.126.net has DNS canonical name ipservice.163.com, which appears to support the Chinese news web site www.163.com with the English title NetEase.

      My router port maps incoming 443 to 8443, assuming the HTTPS.

       

      The evoked source code appears to be:

       

          public ServletPathMatch getServletHandlerByPath(final String path) {

               ServletPathMatch exact = exactPathMatches.get(path);

               if (exact != null) {

                   return exact;

               }

               SubstringMap.SubstringMatch<PathMatch> match = prefixMatches.get(path, path.length());

               if (match != null) {

                   return handleMatch(path, match.getValue(), path.lastIndexOf('.'));

               }

               int extensionPos = -1;

               for (int i = path.length() - 1; i >= 0; --i) {

                   final char c = path.charAt(i);

                    if (c == '/') {

                       match = prefixMatches.get(path, i);

                       if (match != null) {

                           return handleMatch(path, match.getValue(), extensionPos);

                       }

                   } else if (c == '.' && extensionPos == -1) {

                           extensionPos = i;

                   }

               }

               //this should never happen
              //as the default servlet is aways registered under /*
              throw UndertowMessages.MESSAGES.servletPathMatchFailed();

           }

       

      MESSAGES.servletPathMatchFailed() does not include values for the prefixMatches and path variables and I don't want to futz with recompiling Wildfly.

      Even though these messages are currently infrequent, they could be generated to create a denial of service attack.

       

      Bob Kirby

      http://bobkirby.info/site.htm