DevYukine / Kurasuta

A Custom discord.js Sharding Library inspired by eris-sharder.
MIT License
160 stars 23 forks source link

Errors causing my bot to restart. #361

Open Vexyr opened 4 years ago

Vexyr commented 4 years ago

I have two errors and they are constantly restarting my bot. Errors:

events.js:298
      throw er; // Unhandled 'error' event
      ^
MessageError: Failed to process message during connection, calling disconnect: Unknown type received: 1 [UnknownType]
    at Object.makeError (/root/bot/node_modules/veza/dist/lib/Structures/MessageError.js:33:16)
    at ServerSocket._onData (/root/bot/node_modules/veza/dist/lib/ServerSocket.js:93:62)
    at Socket.emit (events.js:321:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:273:9)
    at Socket.Readable.push (_stream_readable.js:214:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on ShardingManager instance at:
    at MasterIPC.<anonymous> (/root/bot/kurasuta/dist/Sharding/ShardingManager.js:41:42)
    at MasterIPC.emit (events.js:321:20)
    at Server.<anonymous> (/root/bot/kurasuta/dist/IPC/MasterIPC.js:15:40)
    at Server.emit (events.js:321:20)
    at ServerSocket._onData (/root/bot/node_modules/veza/dist/lib/ServerSocket.js:93:33)
    at Socket.emit (events.js:321:20)
    [... lines matching original stack trace ...]
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
  kind: 'UnknownType'
}

and

events.js:298
      throw er; // Unhandled 'error' event
      ^
MessageError: Failed to parse message: Found End-Of-Buffer, expecting a `NullTerminator` before. [UnexpectedEndOfBuffer]
    at Object.makeError (/root/bot/node_modules/veza/dist/lib/Structures/MessageError.js:33:16)
    at ClientSocket._onData (/root/bot/node_modules/veza/dist/lib/ClientSocket.js:93:58)
    at Socket.emit (events.js:321:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:273:9)
    at Socket.Readable.push (_stream_readable.js:214:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on ClusterIPC instance at:
    at Client.<anonymous> (/root/bot/kurasuta/dist/IPC/ClusterIPC.js:14:40)
    at Client.emit (events.js:321:20)
    at ClientSocket._onData (/root/bot/node_modules/veza/dist/lib/ClientSocket.js:93:29)
    at Socket.emit (events.js:321:20)
    [... lines matching original stack trace ...]
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
  kind: 'UnexpectedEndOfBuffer'
}
events.js:298
      throw er; // Unhandled 'error' event
      ^
Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on ShardingManager instance at:
    at MasterIPC.<anonymous> (/root/bot/kurasuta/dist/Sharding/ShardingManager.js:41:42)
    at MasterIPC.emit (events.js:321:20)
    at Server.<anonymous> (/root/bot/kurasuta/dist/IPC/MasterIPC.js:15:40)
    at Server.emit (events.js:321:20)
    at ServerSocket._onError (/root/bot/node_modules/veza/dist/lib/ServerSocket.js:106:21)
    at Socket.emit (events.js:321:20)
    at emitErrorNT (internal/streams/destroy.js:84:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}

How can I solve it?

DevYukine commented 4 years ago

Thanks for reaching out to me, this is a known issue by an underlying library used for IPC calls named Veza, the developer is aware of the issue but is currently unable to locate it.

Possible fixes:

for the ECONNRESET, thats an issue with your connection but since kurasuta does not support sharding across machines im confused on how that can happen, did you maybe change/restart local networking?

Vexyr commented 4 years ago

@DevYukine now this error causes my bot to restart. Is this issue related to veza?

/root/bot/node_modules/kurasuta/dist/IPC/MasterIPC.js:31
        const { op } = message.data;
                   ^

TypeError: Cannot destructure property 'op' of 'message.data' as it is null.
    at MasterIPC._incommingMessage (/root/bot/node_modules/kurasuta/dist/IPC/MasterIPC.js:31:17)
    at Server.emit (events.js:321:20)
    at ServerSocket._onData (/root/bot/node_modules/veza/dist/lib/ServerSocket.js:99:33)
    at Socket.emit (events.js:321:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:273:9)
    at Socket.Readable.push (_stream_readable.js:214:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Saadar commented 4 years ago

Hello, @DevYukine,

I have been having this issue for almost a year now, been waiting for any updates/fixes that could help, but did not see any.

I have tried to remove this.disconnect() line from veza node modules, but the issue remains, bot keeps crashing at least once daily.

Tried to go around this issue all possible ways (like saving current music queue, or messages awaiting reactions and then restoring on bot reboot) but it is getting too frustrating.

If you have any suggestions to resolve this, I would be extremely grateful, since other option would be to no longer use this library and find a replacement sadly.

Looking forward for your reply.


events.js:292
      throw er; // Unhandled 'error' event
      ^
MessageError: Failed to process message during connection, calling disconnect: Unknown type received: 67 [UnknownType]
    at Object.makeError (/root/SethBot/node_modules/veza/dist/lib/Structures/MessageError.js:33:16)
    at ServerSocket._onData (/root/SethBot/node_modules/veza/dist/lib/ServerSocket.js:93:62)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on ShardingManager instance at:
    at MasterIPC.<anonymous> (/root/SethBot/node_modules/kurasuta/dist/Sharding/ShardingManager.js:54:42)
    at MasterIPC.emit (events.js:315:20)
    at Server.<anonymous> (/root/SethBot/node_modules/kurasuta/dist/IPC/MasterIPC.js:16:40)
    at Server.emit (events.js:315:20)
    at ServerSocket._onData (/root/SethBot/node_modules/veza/dist/lib/ServerSocket.js:93:33)
    at Socket.emit (events.js:315:20)
    [... lines matching original stack trace ...]
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
  kind: 'UnknownType'
}
Restarting Bot in 5..`
itsmishra19 commented 3 years ago

Hello, @DevYukine,

I have been having this issue for almost a year now, been waiting for any updates/fixes that could help, but did not see any.

I have tried to remove this.disconnect() line from veza node modules, but the issue remains, bot keeps crashing at least once daily.

Tried to go around this issue all possible ways (like saving current music queue, or messages awaiting reactions and then restoring on bot reboot) but it is getting too frustrating.

If you have any suggestions to resolve this, I would be extremely grateful, since other option would be to no longer use this library and find a replacement sadly.

Looking forward for your reply.

events.js:292
      throw er; // Unhandled 'error' event
      ^
MessageError: Failed to process message during connection, calling disconnect: Unknown type received: 67 [UnknownType]
    at Object.makeError (/root/SethBot/node_modules/veza/dist/lib/Structures/MessageError.js:33:16)
    at ServerSocket._onData (/root/SethBot/node_modules/veza/dist/lib/ServerSocket.js:93:62)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on ShardingManager instance at:
    at MasterIPC.<anonymous> (/root/SethBot/node_modules/kurasuta/dist/Sharding/ShardingManager.js:54:42)
    at MasterIPC.emit (events.js:315:20)
    at Server.<anonymous> (/root/SethBot/node_modules/kurasuta/dist/IPC/MasterIPC.js:16:40)
    at Server.emit (events.js:315:20)
    at ServerSocket._onData (/root/SethBot/node_modules/veza/dist/lib/ServerSocket.js:93:33)
    at Socket.emit (events.js:315:20)
    [... lines matching original stack trace ...]
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
  kind: 'UnknownType'
}
Restarting Bot in 5..`

same issue my bot is restarting when it completes more than 7 hours