VoiceConnection disconnects after roughly 1 minute every time on WSL2
See original GitHub issueWhich package is this bug report for?
voice
Issue description
I created a music bot while following the most recent guide and the voice connection dies out at around the same time. No errors are thrown.
After roughly one minute the voiceConnection changes state from connecting to signaling and freezes indefinitely until I restart, sometimes the bot doesn’t even disconnect. Please ignore the ytdl
package, I have tested this with a normal local file and it does the same thing.
I’ve logged the state changes because those are the only things that change, as I said no errors are thrown and voiceConnection decides to change from Ready
to Connecting
to Signalling
and stays that way.
The project can be found at https://github.com/Beriu/boomtsy
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.11.0
- prism-media: 1.3.4
Opus Libraries
- @discordjs/opus: 0.8.0
- opusscript: 0.0.8
Encryption Libraries
- sodium-native: 3.4.1
- sodium: 3.0.2
- libsodium-wrappers: 0.7.10
- tweetnacl: 1.0.3
FFmpeg
- version: 5.0.1-static https://johnvansickle.com/ffmpeg/
- libopus: yes
--------------------------------------------------
Code sample
Bot is running...
Trying to create new voice connection: 777883619157999646
[17:11:13][VoiceConnection][signalling->connecting]
[17:11:13][VoiceConnection][connecting->connecting]
[17:11:13][VoiceConnection][connecting->connecting]
[17:11:13][VoiceConnection][connecting->connecting]
[17:11:13][VoiceConnection][connecting->ready]
[17:11:13][VoiceConnection][ready->ready]
Add command Queue size: 0
Start command Queue size: 1
[17:11:15][AudioPlayer][idle->buffering]
[17:11:15][AudioPlayer][buffering->playing]
[17:12:13][VoiceConnection][ready->connecting]
[17:12:13][AudioPlayer][playing->idle]
[17:12:13][VoiceConnection][connecting->signalling]
Package version
14.2.1
Node.js version
v16.16.0 (Typescript 4.7.4)
Operating system
WSL 2 (Windows subsystem for Linux, Ubuntu)
Priority this issue should have
Low (slightly annoying)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildVoiceStates
I have tested this issue on a development release
c97977a
Issue Analytics
- State:
- Created a year ago
- Comments:9
Top GitHub Comments
I’ve been experiencing the same issue on my Linux ubuntu service VM. Bot can run for hours on windows with no issue, but every time i try on linux it just stops after a min or so.
I’ve had it setup with discord.js v12 for many years with no issues, but the recent update to v13, and now v14 seems to have started the issue. That being said it could also be any VM system update as well.
EDIT: I mainly needed it to work for short clips like memes and TTS. So the way i solved it were just to run
getVoiceConnection(guildId).configureNetworking()
before any play action, that would make it work for the next 1 min.I later created a watch together feature that send you to a link where the video played synced with the discord sound, but that also experienced a 1 min cutoff issue. It was hosted on another Linux VM hosted on the same windows server. So I’m highly suspecting this to be a Linux distro issue, or at least windows Linux hosting issue.
I have no idea how but somehow removing my node installation and reinstalling it fixed the issue. I thought maybe the issue was related to the LTS version of node (v16.17.1 as of this comment) so I tried Node v18.10 and the problem went away. I was about to post here that it was the node version but then I thought I better go back and try v16.17.1 again. Sure enough no issue…
All I can do is speculate about what might have fixed it. I had a few things installed globally as well as locally in the project such as
typescript
,ts-node
, andnodemon
. Small possibility some weird interaction was happening there maybe? I think I had tried re-installing project dependencies a couple times today, but I’m so bleary-eyed at this point that I’m wondering if I neglected to actually try just blowing awaynode_modules
before blowing away the whole node installation. So maybe try simply re-installing project dependencies if you haven’t yet. If that doesn’t work then try re-installing the whole node installation.