Just-Some-Bots / MusicBot

:musical_note: The original MusicBot for Discord (formerly SexualRhinoceros/MusicBot)
https://just-some-bots.github.io/MusicBot/
MIT License
3.14k stars 2.36k forks source link

Random crashes, websocket closed #1408

Closed s1h4d0w closed 6 years ago

s1h4d0w commented 6 years ago

I've had this bot running for a week now on my Windows 10 Professional PC (I have a pretty beefy PC that's always on with a 100Mbps fiber connection) but it keeps randomly crashing after about a day.

Here's the full output:

Connected!  Musicbot v1.9.5_2

Bot:   ---/DJ lepel#9328
Owner: ---/lepel#5455

Server List:
 - lepel.tv

Bound to text channels:
 - lepel.tv/music-commands

Autojoining voice chanels:
 - lepel.tv/🎵 music

Options:
  Command prefix: !
  Default volume: 20%
  Skip threshold: 4 votes or 50%
  Now Playing @mentions: Enabled
  Auto-Summon: Disabled
  Auto-Playlist: Enabled
  Auto-Pause: Enabled
  Delete Messages: Enabled
    Delete Invoking: Disabled
  Debug Mode: Disabled
  Downloaded songs will be saved

Attempting to autojoin 🎵 music in lepel.tv
Attempting connection...
Connection established.

[Download] Cached: https://www.youtube.com/watch?v=ISCEilPMNak
[Download] Cached: https://www.youtube.com/watch?v=zJVdtXeXXEU
[Download] Cached: https://www.youtube.com/watch?v=modXbqbsAvs
[Download] Cached: https://www.youtube.com/watch?v=BvxHJRsGI-M
[Download] Cached: https://www.youtube.com/watch?v=blJKoXWlqJk
[Download] Cached: https://www.youtube.com/watch?v=2O1-XNwNq70
[Download] Cached: https://www.youtube.com/watch?v=hBvW-rXaMlk
[Download] Cached: https://www.youtube.com/watch?v=_VU9DjQpvMQ
[Download] Cached: https://www.youtube.com/watch?v=qVqsbBS45Lo
[Download] Cached: https://www.youtube.com/watch?v=0WXMkk8WURE
[config:autopause] Pausing
Task exception was never retrieved
future: <Task finished coro=<VoiceClient.poll_voice_ws() done, defined at C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\voice_client.py:265> exception=ConnectionClosed('WebSocket connection is closed: code = 4014, reason = Disconnected..',)>
Traceback (most recent call last):
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\gateway.py", line 604, in poll_event
    msg = yield from asyncio.wait_for(self.recv(), timeout=30.0, loop=self.loop)
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\asyncio\tasks.py", line 386, in wait_for
    return fut.result()
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\asyncio\futures.py", line 274, in result
    raise self._exception
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\asyncio\tasks.py", line 239, in _step
    result = coro.send(None)
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\site-packages\websockets\protocol.py", line 319, in recv
    raise ConnectionClosed(self.close_code, self.close_reason)
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 4014, reason = Disconnected..

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\asyncio\tasks.py", line 239, in _step
    result = coro.send(None)
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\voice_client.py", line 272, in poll_voice_ws
    yield from self.ws.poll_event()
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\gateway.py", line 607, in poll_event
    raise ConnectionClosed(e) from e
discord.errors.ConnectionClosed: WebSocket connection is closed: code = 4014, reason = Disconnected..
Connected!  Musicbot v1.9.5_2

Bot:   ---/DJ lepel#9328
Owner: ---/lepel#5455

Server List:
 - lepel.tv

Bound to text channels:
 - lepel.tv/music-commands

Autojoining voice chanels:
 - lepel.tv/🎵 music

Options:
  Command prefix: !
  Default volume: 20%
  Skip threshold: 4 votes or 50%
  Now Playing @mentions: Enabled
  Auto-Summon: Disabled
  Auto-Playlist: Enabled
  Auto-Pause: Enabled
  Delete Messages: Enabled
    Delete Invoking: Disabled
  Debug Mode: Disabled
  Downloaded songs will be saved

Attempting to autojoin 🎵 music in lepel.tv

Task exception was never retrieved
future: <Task finished coro=<MusicPlayer.websocket_check() done, defined at C:\Users\Nick\MusicBot\musicbot\player.py:280> exception=TimeoutError()>
Traceback (most recent call last):
  File "C:\Users\Nick\MusicBot\musicbot\player.py", line 287, in websocket_check
    assert self.voice_client.ws.open
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\asyncio\tasks.py", line 239, in _step
    result = coro.send(None)
  File "C:\Users\Nick\MusicBot\musicbot\player.py", line 291, in websocket_check
    await self.bot.reconnect_voice_client(self.voice_client.channel.server)
  File "C:\Users\Nick\MusicBot\musicbot\bot.py", line 310, in reconnect_voice_client
    new_vc = await self.get_voice_client(vc.channel)
  File "C:\Users\Nick\MusicBot\musicbot\bot.py", line 237, in get_voice_client
    s_id_data = await asyncio.wait_for(s_id, timeout=10, loop=self.loop)
  File "C:\Users\Nick\AppData\Local\Programs\Python\Python35\lib\asyncio\tasks.py", line 390, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError
jayktaylor commented 6 years ago

The bot was updated a day or two ago to 1.9.6. Can you try updating the bot (there’s a guide on the wiki) and seeing if that helps reduce these?

s1h4d0w commented 6 years ago

I installed the bot through your wiki, but using "git pull" in the git bash terminal gives me:

fatal: Not a git repository (or any of the parent directories): .git

Edit: Nevermind, did not know I had to navigate to the musicbot folder before executing that. Might be handy to add to the wiki for the noobs under us.

s1h4d0w commented 6 years ago

Now keeps on working! Still gives random errors now and again but the bot keeps working and reconnects if it loses connection.

jayktaylor commented 6 years ago

Yeah the latest version includes some fixes and adjustments to make it more stable, and when it can’t be stable, at least make an effort to fix itself