Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Websockets doesnt work #16132

Closed
Manny404 opened this issue Mar 30, 2021 · 5 comments
Closed

New Websockets doesnt work #16132

Manny404 opened this issue Mar 30, 2021 · 5 comments
Labels
env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@Manny404
Copy link

Manny404 commented Mar 30, 2021

Describe the bug

I am getting an exception and the websocket connection will be closed. After the update to 1.13.0.Final. The same code is working with 1.12.2.

An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually
means the last handler in the pipeline did not handle the exception.: io.netty.handler.codec.http.websocketx.CorruptedWebSocketFrameException: RSV != 0 and no extension negotiated, RSV:
4

Expected behavior

Working as with Quarkus 1.12.2 No Exception and die ability to transfer data on the websocket connection

Actual behavior

I am getting an exception and the websocket connection will be closed.

To Reproduce

The error is reproduceable with the websocket example. After the click on connect.

https://quarkus.io/guides/websockets

Configuration

empty

Environment (please complete the following information):

Output of uname -a or ver

Microsoft Windows [Version 10.0.18363.1379]
### Output of `java -version`
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_265-b01)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.265-b01, mixed mode)
### GraalVM version (if different from Java)

Quarkus version or git rev

1.13.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\U2309690\maven\bin\..
Java version: 1.8.0_265, vendor: AdoptOpenJDK, runtime: C:\Program Files\AdoptOpenJDK\jdk-8.0.265.01-hotspot\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

##Stacktrace

2021-03-30 23:58:06,362 WARN  [io.net.cha.DefaultChannelPipeline] (vert.x-eventloop-thread-2) An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.: io.netty.handler.cod
ec.http.websocketx.CorruptedWebSocketFrameException: RSV != 0 and no extension negotiated, RSV:4
        at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.protocolViolation(WebSocket08FrameDecoder.java:426)
        at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.protocolViolation(WebSocket08FrameDecoder.java:422)
        at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.decode(WebSocket08FrameDecoder.java:197)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
@Manny404 Manny404 added the kind/bug Something isn't working label Mar 30, 2021
@quarkus-bot quarkus-bot bot added the env/windows Impacts Windows machines label Mar 30, 2021
@geoand
Copy link
Contributor

geoand commented Mar 31, 2021

cc @stuartwdouglas

@eraserpl
Copy link

Started to learn quarkus and encounter this bug. (ubuntu environment)

@stuartwdouglas
Copy link
Member

quarkusio/quarkus-http#67 will fix it

@stuartwdouglas
Copy link
Member

If you need a workaround you can include the following in your project:

package org.acme.websockets;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.vertx.core.Handler;
import io.vertx.core.http.HttpConnection;
import io.vertx.core.http.impl.Http1xServerConnection;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;

import javax.enterprise.event.Observes;

public class Fixer {
    public void fix(@Observes Router router) {
        router.route().order(Integer.MIN_VALUE).handler(new Handler<RoutingContext>() {
            @Override
            public void handle(RoutingContext event) {

                HttpConnection con = event.request().connection();
                if (con instanceof Http1xServerConnection) {
                    Http1xServerConnection connection = (Http1xServerConnection) con;
                    ChannelHandlerContext context = connection.channelHandlerContext();
                    final ChannelHandler websocketChannelHandler = context.pipeline().get("websocketExtensionHandler");
                    if (websocketChannelHandler != null) {
                        context.pipeline().remove(websocketChannelHandler);
                    }
                }
                event.next();
            }
        });
    }
}

@gsmet gsmet added this to the 1.13.1.Final milestone Apr 1, 2021
@gsmet
Copy link
Member

gsmet commented Apr 7, 2021

Will be fixed in 1.13.1.Final.

@gsmet gsmet closed this as completed Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants