destruc7i0n / shulker

A Discord to Vanilla Minecraft Chat Gateway
ISC License
135 stars 47 forks source link

Intermittent Crashes #41

Open Bowilla opened 5 years ago

Bowilla commented 5 years ago

I am getting the following error:

events.js:180

    throw err; // Unhandled 'error' event
    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
    at Client.emit (events.js:178:17)
    at WebSocketConnection.onError (/home/bowilla/mc/main/shulker/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
    at WebSocket.onError (/home/bowilla/mc/main/shulker/node_modules/ws/lib/event-target.js:128:16)
    at WebSocket.emit (events.js:189:13)
    at _receiver.cleanup (/home/bowilla/mc/main/shulker/node_modules/ws/lib/websocket.js:211:14)
    at Receiver.cleanup (/home/bowilla/mc/main/shulker/node_modules/ws/lib/receiver.js:557:13)
    at WebSocket.finalize (/home/bowilla/mc/main/shulker/node_modules/ws/lib/websocket.js:206:20)
    at TLSSocket.emit (events.js:189:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Shulker has worked very well, but then this error comes intermittently. It works for about a day or so and then crashes with this error and requires a restart to continue. I thought about running it with nodemon(auto-restarter) instead of yarn, but I would prefer to fix the issue if possible.

I noticed in this line that the error is rooted in the discord.js websocket connection, but I couldn't tell if this was a bug in discord.js error handling or in shulkers error handling. at WebSocketConnection.onError (/home/bowilla/mc/main/shulker/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)

I just want to know if it is possible or not to be fixed in shulker. I don't know since I have seen deep-rooted errors, that don't relate back to my script but is in fact my error.

I see with issue #9 that there is something related to what you are doing inside Discord. I quickly tested all of that and can confirm it is not the cause. As of now I cannot reproduce when or why it happens, but it does happen about once everyday.

As a quick side note, there is a deprecated use of Buffer used in shulker which will causes crashes in the future: (node:13869) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

TheZackCodec commented 5 years ago

@Bowilla I have been experiencing the same exact thing.

I know this is terrible practice and definitely not a permanent but solution it works perfectly. Create the following script and run it. You can change the sleep timer to whatever. Since this should be fixed later I didn't want to make a more permanent solution


#!/usr/bin/env bash
while true; do
        yarn start
        echo "Opsie Doopsie, I made an Oopsie Whoopsie"
        sleep 1m
done