You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a discord bot that runs in the background for long periods of time that usually works great. Intermittently, I get a WebSocketException in the logs (see log section). After that, the bot no longer appears online and doesn't receive messages. I have to shut everything down and restart the bot.
Version Information
Clojure Version: 1.11.1
Discljord Version: 1.3.1
OS bot is hosted on: Linux
To Reproduce
I don't have a consistent approach to reproducing the exception, but I think there might still be enough info to attempt a fix.
Expected behavior
The bot should continue trying to reconnect.
Logs
Jul 25, 2023 12:33:26 AM discljord.connections.impl invoke
INFO: Exiting the shard loop
Exception in thread "async-dispatch-10" java.util.concurrent.ExecutionException: org.eclipse.jetty.websocket.api.WebSocketException: Session closed
at org.eclipse.jetty.util.FutureCallback.get(FutureCallback.java:123)
at org.eclipse.jetty.util.FutureCallback.get(FutureCallback.java:30)
at clojure.core$deref_future.invokeStatic(core.clj:2317)
at clojure.core$deref.invokeStatic(core.clj:2337)
at clojure.core$deref.invoke(core.clj:2323)
at gniazdo.core$eval32382$fn__32383.invoke(core.clj:21)
at gniazdo.core$eval32363$fn__32364$G__32354__32371.invoke(core.clj:17)
at gniazdo.core$connect_with_client$reify__32474.send_msg(core.clj:138)
at discljord.connections.impl$step_shard_BANG_$heartbeat_fn__33010.invoke(impl.clj:393)
at discljord.connections.impl$step_shard_BANG_$fn__33161$state_machine__16821__auto____33188$fn__33190.invoke(impl.clj:438)
at discljord.connections.impl$step_shard_BANG_$fn__33161$state_machine__16821__auto____33188.invoke(impl.clj:431)
at clojure.core.async.impl.runtime$run_state_machine.invokeStatic(runtime.clj:62)
at clojure.core.async.impl.runtime$run_state_machine.invoke(runtime.clj:61)
at clojure.core.async.impl.runtime$run_state_machine_wrapped.invokeStatic(runtime.clj:66)
at clojure.core.async.impl.runtime$run_state_machine_wrapped.invoke(runtime.clj:64)
at clojure.core.async$ioc_alts_BANG_$fn__11707.invoke(async.clj:423)
at clojure.core.async$do_alts$fn__11638$fn__11641.invoke(async.clj:290)
at clojure.core.async.impl.channels.ManyToManyChannel$fn__11351$fn__11352.invoke(channels.clj:100)
at clojure.lang.AFn.run(AFn.java:22)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at clojure.core.async.impl.concurrent$counted_thread_factory$reify__11220$fn__11221.invoke(concurrent.clj:29)
at clojure.lang.AFn.run(AFn.java:22)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.eclipse.jetty.websocket.api.WebSocketException: Session closed
at org.eclipse.jetty.websocket.common.WebSocketSession.outgoingFrame(WebSocketSession.java:350)
at org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint.uncheckedSendFrame(WebSocketRemoteEndpoint.java:322)
at org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint.sendAsyncFrame(WebSocketRemoteEndpoint.java:243)
at org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint.sendStringByFuture(WebSocketRemoteEndpoint.java:419)
at gniazdo.core$eval32382$fn__32383.invoke(core.clj:24)
... 18 more
Additional context
I'm running the bot on a dinky server
The server is usually not doing much, but sometimes has a lot of work to do that might bog down the CPU and/or cause memory pressure on the JVM
The text was updated successfully, but these errors were encountered:
This looks to me like this is happening when Discord is shutting down the gateway server your bot is connected to. In that case I would expect discljord to attempt to reconnect, however I can attempt to reproduce this error with a mock discord server and see about fixing it.
Thanks for bringing it up!
If I'm right about what's caused the issue, I wouldn't expect this to be a frequent occurrence, but it is important to be aware of until it's fixed.
Very cool. Thanks for the project. It's been great.
The problem doesn't occur too much, but I think there's something about my server usage (eg. dinky server with intermittent CPU and Memory spikes) that makes it more likely.
I have a discord bot that runs in the background for long periods of time that usually works great. Intermittently, I get a
WebSocketException
in the logs (see log section). After that, the bot no longer appears online and doesn't receive messages. I have to shut everything down and restart the bot.Version Information
To Reproduce
I don't have a consistent approach to reproducing the exception, but I think there might still be enough info to attempt a fix.
Expected behavior
The bot should continue trying to reconnect.
Logs
Additional context
The text was updated successfully, but these errors were encountered: