question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Websockets doesnt work

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stuartwdouglascommented, Apr 1, 2021

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();
            }
        });
    }
}
1reaction
stuartwdouglascommented, Apr 1, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Websockets not working - Stack Overflow
Try this example: var url = "ws://echo.websocket.org"; if (!window.WebSocket) alert("WebSocket not supported by this browser"); var myWebSocket = { connect: ...
Read more >
Websockets server does not work live - JavaScript - SitePoint
The console gives this error: WebSocket connection to 'wss://localhost:8080/echo' failed: Any clue how I can make this work?
Read more >
Troubleshooting connection issues | Socket.IO
You are trying to reach a plain WebSocket server; The server is not reachable; The client is not compatible with the version of...
Read more >
wss websocket stopped working | Firefox Support Forum
Today firsfox just stopped connecting to a wss websocket server. It has always worked fine before today and still works in Chrome.
Read more >
WebSocket - The Modern JavaScript Tutorial
To open a websocket connection, we need to create new WebSocket using the special ... Old proxy servers do not know about WebSocket, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found