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

Make JDA bubble up websocket crashes as ExceptionEvent #2647

Open
2 tasks done
DeepSnowNeeL opened this issue Apr 11, 2024 · 1 comment
Open
2 tasks done

Make JDA bubble up websocket crashes as ExceptionEvent #2647

DeepSnowNeeL opened this issue Apr 11, 2024 · 1 comment
Labels

Comments

@DeepSnowNeeL
Copy link

DeepSnowNeeL commented Apr 11, 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.22

Expected Behaviour

It should not hang on jda.awaitReady(); indefinitely when the websocket encounters an error.

In my situation I had badly updated my libraries and had in my pom this :

<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>2.13.3</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-annotations</artifactId>
			<version>2.17.0</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.17.0</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.datatype</groupId>
			<artifactId>jackson-datatype-jsr310</artifactId>
			<version>2.17.0</version>
		</dependency>

This de-sync in versions caused the ListenerManager#callOnConnected from nv-websocket-client to throw java.lang.NoSuchMethodError: 'void com.fasterxml.jackson.core.util.BufferRecycler.releaseToPool()' which is not handled and reported to the end user because it seems from what I have seen that the class WebSocketClient ignores the handleCallbackError (I found out that AudioWebSocket actually does and correctly "rethrows" it by wrapping it in an ExceptionEvent)

My suggestion is that it should log the error somewhere or allow me to catch it by listening to ExceptionEvents (probably both)

(there is other methods like onUnexpectedError which might need to be handled by WebSocketClient too I guess ? maybe all others onXError, looks like onError is already implemented correctly)

Code Example for Reproduction Steps

JDA jda = JDABuilder.createDefault(token)
                    .setActivity(Activity.listening("..."))
                    .build();

            try {
                jda.awaitReady(); //hangs there
            } catch (InterruptedException e) {
                System.err.println(e);
                return;
            }

Code for JDABuilder or DefaultShardManagerBuilder used

JDA jda = JDABuilder.createDefault(token)
                    .setActivity(Activity.listening("..."))
                    .build();

Exception or Error

No error when it should be (see expected behaviour)
@MinnDevelopment
Copy link
Member

This should be improved in 5.0.0-beta.24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants