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

Exception in WS read thread: RSV1 bit of a frame is set unexpectedly #2663

Open
2 tasks done
freya022 opened this issue Apr 22, 2024 · 11 comments
Open
2 tasks done

Exception in WS read thread: RSV1 bit of a frame is set unexpectedly #2663

freya022 opened this issue Apr 22, 2024 · 11 comments
Labels
type: discord issue seems to be an issue on discord's end

Comments

@freya022
Copy link
Contributor

freya022 commented Apr 22, 2024

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have checked for PRs that might already address this issue.

Version of JDA

5.0.0-beta.18

Expected Behaviour

Handle the frame gracefully I guess?

Code Example for Reproduction Steps

N/A

Code for JDABuilder or DefaultShardManagerBuilder used

JDABuilder.createLight(token)
            .enableIntents(GatewayIntent.MESSAGE_CONTENT)
            .setActivity(Activity.customStatus("I need more bullets"))
            .setEventManager(/* */)
            .build()

Exception or Error

08:23:31.148 JDA MainWS-ReadThread      n.d.j.i.requests.WebSocketClient     #onError                  L1113  WebSocketClient      ERROR  There was an error in the WebSocket connection
com.neovisionaries.ws.client.WebSocketException: The RSV1 bit of a frame is set unexpectedly.
	at com.neovisionaries.ws.client.ReadingThread.verifyReservedBit1(ReadingThread.java:481)
	at com.neovisionaries.ws.client.ReadingThread.verifyReservedBits(ReadingThread.java:451)
	at com.neovisionaries.ws.client.ReadingThread.verifyFrame(ReadingThread.java:421)
	at com.neovisionaries.ws.client.ReadingThread.readFrame(ReadingThread.java:341)
	at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:99)
	at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
	at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

BEFORE REPORTING A SIMILAR ERROR

Please update to the JDA snapshot #2663 (comment) and include the WebSocket trace with the error

@MinnDevelopment MinnDevelopment added the status: need more info in need of additional details label Apr 23, 2024
@MinnDevelopment
Copy link
Member

The latest master commit added a new trace information to further investigate this issue, please let me know when you encounter the error including that trace detail.

@JayMaro
Copy link

JayMaro commented Apr 24, 2024

I tried this and it works fine in my environment
I used JDK 17 and dependencies {implementation("net.dv8tion:JDA:5.0.0-beta.18")} and run by InteliJ
This is my test code and result

import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.requests.GatewayIntent;

public class BotApplication {

    public static void main(String[] args) {
        JDABuilder.createLight(Bot.token) // my test token
            .enableIntents(GatewayIntent.MESSAGE_CONTENT)
            .setActivity(Activity.customStatus("I need more bullets"))
            .setEventManager(null)
            .build();
    }
}

스크린샷 2024-04-24 오후 9 35 32

스크린샷 2024-04-24 오후 9 35 21

@freya022
Copy link
Contributor Author

This is not an issue on startup, it happens at random times, days after the bot started, multiple people have reported this issue, I've created this issue for tracking purpose, so it can also be linked when a fix is available

@JayMaro
Copy link

JayMaro commented Apr 24, 2024

Oh, I see. I didn't know that. Thank you for telling me. :)

@duncte123
Copy link
Contributor

Got one running main: https://duncte123.sentry.io/share/issue/fac5e12d2d2c40bc8baa0a46f21fc64f/

@MinnDevelopment MinnDevelopment added the type: discord issue seems to be an issue on discord's end label Apr 28, 2024
@rakosi2
Copy link

rakosi2 commented May 2, 2024

Got one running 5.0.0-beta.23

@freya022
Copy link
Contributor Author

freya022 commented May 2, 2024

Got one running 5.0.0-beta.23

Please send the exception with the WS trace, like duncte123 sent

@rakosi2
Copy link

rakosi2 commented May 2, 2024

I don't think I have WS trace enabled or how to retrieve it. I have the stacktrace that is the same as the OP
[2024/05/02 23:20:23] [ERROR] [JDA MainWS-ReadThread] ERROR WebSocketClient - There was an error in the WebSocket connection com.neovisionaries.ws.client.WebSocketException: The RSV1 bit of a frame is set unexpectedly. at com.neovisionaries.ws.client.ReadingThread.verifyReservedBit1(ReadingThread.java:481) at com.neovisionaries.ws.client.ReadingThread.verifyReservedBits(ReadingThread.java:451) at com.neovisionaries.ws.client.ReadingThread.verifyFrame(ReadingThread.java:421) at com.neovisionaries.ws.client.ReadingThread.readFrame(ReadingThread.java:341) at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:99) at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64) at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45) [2024/05/02 23:20:23] [ERROR] Exception while handling JDA event:: com.neovisionaries.ws.client.WebSocketException: The RSV1 bit of a frame is set unexpectedly. at com.neovisionaries.ws.client.ReadingThread.verifyReservedBit1(ReadingThread.java:481) at com.neovisionaries.ws.client.ReadingThread.verifyReservedBits(ReadingThread.java:451) at com.neovisionaries.ws.client.ReadingThread.verifyFrame(ReadingThread.java:421) at com.neovisionaries.ws.client.ReadingThread.readFrame(ReadingThread.java:341) at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:99) at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64) at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

@freya022
Copy link
Contributor Author

freya022 commented May 2, 2024

Ah yea, please updated to the latest snapshot:

Maven:

<repositories>
    <repository>
        <id>jitpack</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>io.github.discord-jda</groupId>
        <artifactId>JDA</artifactId>
        <version>6f7189f91a</version>
    </dependency>
</dependencies>

Gradle (Kotlin):

repositories {
    mavenCentral()
    maven("https://jitpack.io")
}

dependencies {
    implementation("io.github.discord-jda:JDA:6f7189f91a")
}

@rakosi2
Copy link

rakosi2 commented May 2, 2024

I have updated my POM, will see if I get it again. Slaynash/Lumbot@d30becd

@MinnDevelopment
Copy link
Member

This issue has been escalated to cloudflare. Apparently, the web socket is receiving an http response body instead of a web socket frame. The specific bit happens to be set when the frame starts with HTTP/1.1 502 Bad Gateway Server.

@MinnDevelopment MinnDevelopment removed the status: need more info in need of additional details label May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discord issue seems to be an issue on discord's end
Projects
None yet
Development

No branches or pull requests

5 participants