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

Crash when voice connection is lost. #66

Open
DaleJV opened this issue Feb 5, 2022 · 10 comments
Open

Crash when voice connection is lost. #66

DaleJV opened this issue Feb 5, 2022 · 10 comments
Labels
Priority: Medium This is medium priority. Type: Bug This is a bug report.

Comments

@DaleJV
Copy link
Contributor

DaleJV commented Feb 5, 2022

🐛 Describe the Bug

After having the bot run for 2 days on my server, it completely crashes

✏️ Steps to Reproduce

  1. Turn of pause music on empty server
  2. Run bot for multiple days
  3. 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, and type: '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
@DaleJV DaleJV added the Type: Bug This is a bug report. label Feb 5, 2022
@moonstar-x
Copy link
Owner

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.

@DaleJV
Copy link
Contributor Author

DaleJV commented Feb 6, 2022

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.

@moonstar-x
Copy link
Owner

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.

@DaleJV
Copy link
Contributor Author

DaleJV commented Feb 8, 2022

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?

@moonstar-x
Copy link
Owner

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.

@moonstar-x
Copy link
Owner

Let me change the title of the issue to something a bit more relevant.

@moonstar-x moonstar-x changed the title The bot completely crashes after a day or two of 24/7 playback Crash when voice connection is lost. Feb 8, 2022
@moonstar-x moonstar-x added the Priority: Medium This is medium priority. label Feb 8, 2022
@Dalrae1
Copy link

Dalrae1 commented Apr 21, 2022

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.

@headasstommy
Copy link

got a fix?

@moonstar-x
Copy link
Owner

Not yet. 😭

@headasstommy
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium This is medium priority. Type: Bug This is a bug report.
Projects
None yet
Development

No branches or pull requests

4 participants