Crash when voice connection is lost.
DaleJV opened this issue ยท 10 comments
๐ Describe the Bug
After having the bot run for 2 days on my server, it completely crashes
โ๏ธ Steps to Reproduce
- Turn of pause music on empty server
- Run bot for multiple days
- See error...
๐ Expected Behavior
The bot should not be crashing, its a 24/7 bot. Its gives issues such as code:
'ERR_UNHANDLED_ERROR'
,Error: getaddrinfo ENOTFOUND sydney4015.discord.media
, andtype: 'error', message: 'getaddrinfo ENOTFOUND sydney4015.discord.media'
,
๐ Log
node:events:381
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. (ErrorEvent {
target: WebSocket {
_events: [Object: null prototype] {
open: [Function],
message: [Function],
close: [Function],
error: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
_binaryType: 'nodebuffer',
_closeCode: 1006,
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: '',
_closeTimer: null,
_extensions: {},
_protocol: '',
_readyState: 2,
_receiver: null,
_sender: null,
_socket: null,
_bufferedAmount: 0,
_isServer: false,
_redirects: 0,
_url: 'wss://sydney4015.discord.media/?v=4&encoding=json',
_req: null,
[Symbol(kCapture)]: false
},
type: 'error',
message: 'getaddrinfo ENOTFOUND sydney4015.discord.media',
error: Error: getaddrinfo ENOTFOUND sydney4015.discord.media
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'sydney4015.discord.media'
}
})
at new NodeError (node:internal/errors:371:5)
at VoiceConnection.emit (node:events:379:17)
at VoiceWebSocket.<anonymous> (C:\Users\User\Desktop\DC bot\project\discord-music-24-7\node_modules\discord.js\src\client\voice\VoiceConnection.js:422:32)
at VoiceWebSocket.emit (node:events:390:28)
at VoiceWebSocket.onError (C:\Users\User\Desktop\DC bot\project\discord-music-24-7\node_modules\discord.js\src\client\voice\networking\VoiceWebSocket.js:160:10)
at WebSocket.onError (C:\Users\User\Desktop\DC bot\project\discord-music-24-7\node_modules\ws\lib\event-target.js:140:16)
at WebSocket.emit (node:events:390:28)
at emitErrorAndClose (C:\Users\User\Desktop\DC bot\project\discord-music-24-7\node_modules\ws\lib\websocket.js:835:13)
at ClientRequest.<anonymous> (C:\Users\User\Desktop\DC bot\project\discord-music-24-7\node_modules\ws\lib\websocket.js:697:5)
at ClientRequest.emit (node:events:390:28) {
code: 'ERR_UNHANDLED_ERROR',
context: ErrorEvent {
target: WebSocket {
_events: [Object: null prototype] {
open: [Function: onOpen] { _listener: [Function: bound onOpen] },
message: [Function: onMessage] { _listener: [Function: bound onMessage] },
close: [Function: onClose] { _listener: [Function: bound onClose] },
error: [Function: onError] { _listener: [Function: bound onError] }
},
_eventsCount: 4,
_maxListeners: undefined,
_binaryType: 'nodebuffer',
_closeCode: 1006,
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: '',
_closeTimer: null,
_protocol: '',
_readyState: 2,
_receiver: null,
_sender: null,
_socket: null,
_bufferedAmount: 0,
_isServer: false,
_redirects: 0,
_url: 'wss://sydney4015.discord.media/?v=4&encoding=json',
_req: null,
[Symbol(kCapture)]: false
},
type: 'error',
message: 'getaddrinfo ENOTFOUND sydney4015.discord.media',
error: Error: getaddrinfo ENOTFOUND sydney4015.discord.media
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'sydney4015.discord.media'
}
}
}
๐ท Screenshots
Paste a screenshot of the bug (if applicable).
โ Other Information
- v16.13.2
Is this a recurring issue?
Kinda sounds like you lost connection to the voice servers.
But I suppose an error like this shouldn't crash the bot.
Its on my server computer which is connected 24/7 via ethernet and none of my other servers lost connection, so I assume its bot related.
To be safe, I will wait another couple of days and see if it happens again and then I will report back here.
Ah probably I didn't explain myself correctly, I didn't mean your server losing connection but losing the link between your server and discord. Could be the discord voice server went out for a bit.
Should that cause a crash?
If so, is there any possibility in the future of developing a function that catches the error and then attempts to reconnect the bot every few seconds?
I think this should not cause a crash, indeed.
I'm going to update this bot once I have some free time to discord.js13, it should have a much better behavior when using voice so hopefully this would be fixed with just an update.
Let me change the title of the issue to something a bit more relevant.
Just wanted to add onto this since I'm also experiencing this with my bot - I am using the latest version of Discord.js and Discord.js/voice and no attempts have been made by them to fix this issue. My bot crashes every few days and it's very annoying. I suspect that since my router resets every few days automatically, that's what's causing the issue.
got a fix?
Not yet. ๐ญ
all good, im also having a problerm where it disconnects if i leave, and sometimes it says its playing music and i cant hear anything (idk how to do logs)