4 Replies Latest reply on Aug 2, 2019 9:36 AM by heruan

    Wildfly 10.1, cluster, load balancing and WebSocket. Does it work together?

    yum

      Hi!

       

      The situation is:

      We're using Wildfly in the cluster mode. Everything is ok, but load balancing on Apache makes our topology not so clean as we would like it to be. We'd prefer to have only one server as nodes, master and load balancer. (Sometimes it's not too easy to explain to a customer why we're installing different servers. Politics, nothing more  )

       

      This year, on Aug 19th - Wildfly 10.1. Seems, we'll be completely happy. Soon. But...

       

      (the problem description)

      Our application is using webSockets. To notify users (not instead of http, in addition to it).

      And when we're trying to use load balancing based on wildfly, any webSocket request kills the current user session.

       

      The questions:

      - is it possible to use webSocket in addition to http(s)? (nodes - Wildfly 10.1, master - too, load balancer - Wildfly 10.1 again)

      - if it's possible - HOW??? (any link, example or something like this)

       

      Thanks in advance

        • 1. Re: Wildfly 10.1, cluster, load balancing and WebSocket. Does it work together?
          jaikiran

          You will have to add a bit more details about what errors, exceptions (if any) you see and what the access URLs look like and how the load balancing has been configured.

          • 2. Re: Wildfly 10.1, cluster, load balancing and WebSocket. Does it work together?
            yum

            With pleasure!

             

            The first thing we've made is follow this video: https://asciinema.org/a/48420

            briefly:

            Overview

             

            The simplest possible setup with Undertow mod_cluster proxy Wildfly 10 laod balancer and two Wildfly 10 workers.

            Balancer

             

                we configure advertising socket binding; the UDP multicast address and port the balacner advertises its precence on

                we configure Undertow mod_cluster filter

                we add this filter to Undertow's http host so as it can receive mod_cluster protocol messages from worker nodes; note that this is not secure. In a production environment we would have a dedicated, secured host configured in Undertow so as we receive mod_cluster special messages only from trusted networks.

             

            Workers

             

                there is no configuration needed but for adjusting mod_cluster socket binding, so as worker nodes know the UDP address:port where the balancer advertises its presence

                one worker has two and the other has a one web application deployed

                note that the balancer correctly forwards requests to the one node that offers that particular application context

                note that with the application that is deployed on both nodes a failover is possible

                watch JSESSIONIDs and jvmRoutes in the curl output to get the gist of the functionality

            The second one is deployment of an example project. It works great (session replication and so on), but the example doesn't contain any WebSocket's stuff.

             

            After that we've tried to deploy our application. Real one. (JSF2.2, PrimeFaces, Atmosphere for WebSocket, full EE7 stack).

             

            And here is the our problem: when the real application uses WebSocket channel to delivery any message then the application throws such exception:

            (in other words: application runs great, works fine till the first WebSocket request)

            2016-12-15 18:44:39,813 ERROR [io.undertow.request] (default task-35) UT005023: Exception handling request to /fos/utracker: java.lang.IllegalStateException: UT000077: The underlying transport does not support HTTP upgrade

                    at io.undertow.server.HttpServerExchange.upgradeChannel(HttpServerExchange.java:866)

                    at io.undertow.servlet.websockets.ServletWebSocketHttpExchange.upgradeChannel(ServletWebSocketHttpExchange.java:137)

                    at io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:117)

                    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)

                    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

                    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)

                    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

                    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

                    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

                    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)

                    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

                    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

                    at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)

                    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

                    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

                    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

                    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)

                    at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)

                    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)

                    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)

                    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)

                    at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)

                    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

                    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)

                    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

                    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                    at java.lang.Thread.run(Thread.java:745)

             

            2016-12-15 18:44:40,477 ERROR [io.undertow.request] (default task-33) UT005023: Exception handling request to /fos/primepush/notify/fos: java.lang.IllegalStateException: UT000077: The underlying transport does not support HTTP upgrade

                    at io.undertow.server.HttpServerExchange.upgradeChannel(HttpServerExchange.java:866)

                    at io.undertow.servlet.websockets.ServletWebSocketHttpExchange.upgradeChannel(ServletWebSocketHttpExchange.java:137)

                    at io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:117)

                    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)

                    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)

                    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)

                    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

                    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

                    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

                    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)

                    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

                    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

                    at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)

                    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

                    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

                    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

                    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)

                    at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)

                    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)

                    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)

                    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)

                    at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)

                    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)

                    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

                    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)

                    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

                    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

                    at java.lang.Thread.run(Thread.java:745)

             

            And a little addition: nodes works great when we're using our application bypassing load-balancer. I.e. when I write in the address bar of any browser URL of any concrete node - all works great. Through load-balancer we've got the exception.

            • 3. Re: Wildfly 10.1, cluster, load balancing and WebSocket. Does it work together?
              gipathak

              Hi Yury, we are also having similar problem but we want to support both http(s) and websocket , getting same exception saying " UT000077: The underlying transport does not support HTTP upgrade " . Did you get any solution , could you please share how you fixed this problem?

              • 4. Re: Wildfly 10.1, cluster, load balancing and WebSocket. Does it work together?
                heruan

                Same problem here with WildFly 17.0.1, but I just get a 500 Internal Server Error on "Connection: Upgrade" request and no exception logged. How did you solve this?