3 Replies Latest reply on May 24, 2015 12:53 AM by tony anecito

    why ERROR: UT005036: ALPN negotiation failed for /192.168.1.112:63217 and no fallback defined, closing connection?

    tony anecito Novice

      I am getting this error when working with Undertow with Wildfly 9.0.0 CR1 libraries.

       

      ERROR: UT005036: ALPN negotiation failed for /192.168.1.112:63217 and no fallback defined, closing connection

       

      I am using java 1.8.0_45 and running example from Undertow :

       

      Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader());

              try {

                  XnioWorker worker = xnio.createWorker(OptionMap.builder()

                          .set(Options.WORKER_IO_THREADS, 8)

                          .set(Options.CONNECTION_HIGH_WATER, 1000000)

                          .set(Options.CONNECTION_LOW_WATER, 1000000)

                          .set(Options.WORKER_TASK_CORE_THREADS, 30)

                          .set(Options.WORKER_TASK_MAX_THREADS, 30)

                          .set(Options.TCP_NODELAY, true)

                          .set(Options.CORK, true)

                          .getMap());

       

                  OptionMap serverOptions = OptionMap.builder()

                          .set(Options.TCP_NODELAY, true)

                          .set(Options.REUSE_ADDRESSES, true)

                          .set(Options.BALANCING_TOKENS, 1)

                          .set(Options.BALANCING_CONNECTIONS, 2)

                          .getMap();

       

                  ByteBufferSlicePool pool = new ByteBufferSlicePool(BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR, 2 * BUFFER_SIZE, 100 * BUFFER_SIZE);

                  openListener = new Http2OpenListener(pool, OptionMap.create(UndertowOptions.ENABLE_SPDY, true));

                  acceptListener = ChannelListeners.openListenerAdapter(new AlpnOpenListener(pool).addProtocol(Http2OpenListener.HTTP2, (io.undertow.server.DelegateOpenListener) openListener, 10));

       

                  SSLContext sslContext = createSSLContext(loadKeyStore("server.keystore"), loadKeyStore("server.truststore"));

                  XnioSsl xnioSsl = new JsseXnioSsl(xnio, OptionMap.EMPTY, sslContext);

                  server = xnioSsl.createSslConnectionServer(worker, new InetSocketAddress("192.168.1.112", 8443), acceptListener, serverOptions);

                  server.resumeAccepts();

                  openListener.setRootHandler(new UndertowTestHandler());

                  server.resumeAccepts();

              } catch (Exception e) {

                  throw new RuntimeException(e);

              }

       

       

      Any idea what might be wrong or how to get more info from Undertow?

       

      Thanks!

      -Tony

        • 1. Re: why ERROR: UT005036: ALPN negotiation failed for /192.168.1.112:63217 and no fallback defined, closing connection?
          tony anecito Novice

          Ok I figured it out. For the example the AlpnOpenListener protocol was set http2. For Chrome when used it is h2-14. The AlpnOpenListener checks to match the versions of the browser protocols to the one AlpnOpenListener is setup with. If no match is found then it logs the error I listed. Interesting enough Firefox when used lists a wide range of http/2 drafts and h2 which I think means the final draft. As long as the listener if used in Wildfly uses h2 and h2-14 protocols then wildfly will work.

           

          I do not know why the http2server example does not appear to use the http/2 protocol and it may be related to default handler  beinng straight https 1.1.

           

          Regards,

          -Tony

          • 2. Re: why ERROR: UT005036: ALPN negotiation failed for /192.168.1.112:63217 and no fallback defined, closing connection?
            Tomaz Cerar Master

            in your code you only enable SPDY and not also HTTP"

             

            openListener = new Http2OpenListener(pool, OptionMap.create(UndertowOptions.ENABLE_SPDY, true));

            you should have something like

            openListener = new Http2OpenListener(pool, OptionMap.create(UndertowOptions.ENABLE_SPDY, true, UndertowOptions.ENABLE_HTTP2, true));

            • 3. Re: why ERROR: UT005036: ALPN negotiation failed for /192.168.1.112:63217 and no fallback defined, closing connection?
              tony anecito Novice

              Thanks Tomaz,

               

              Sorry Red Hat limits how quickly you can create or respond to posts so trying again to respond.

              The code I listed came from the undertow git http2 tests and was meant to only test http/2 and not http. I wanted something I hoped worked for http/2 as a starting point for http/2.

               

              Understanding the http listeners and their order is I believe important to me since the browsers advertise all the protocols maybe as part of the negotiation and order of handling is important. I will look into that tonight to get a better handle on priority.

               

              What I showed is not Wildfly but xnio server. So even though it worked I need to find something in the Undertow examples or tests that creates both in such a way I can control the order they are used. I found Swarm but it is too new and untried for even me but it looks like it is trying to address what I am talking about.

               

              So what I am looking for is:

              create http/2 listener/handler then add to undertow server

              create http listener/handler then add to Undertow server

               

               

              Best Regards,

              -Tony