question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VoiceConnection disconnects after roughly 1 minute every time on WSL2

See original GitHub issue

Which 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:open
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
SindreMAcommented, Oct 4, 2022

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.

1reaction
chevtekcommented, Oct 4, 2022

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, and nodemon. 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 away node_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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WSL2 needs a wsl.exe --terminate everytime. Any suggestion?
I understand that you are having issues with WSL disconnecting after a long period of inactivity. We downloaded WSL based on your question,...
Read more >
Windows 11 losing network connection to WSL2 Ubuntu after ...
I was having a problem with sublime getting a "Not Responding" after some time of use with files inside WSL2 Ubuntu, but I...
Read more >
Inactive TCP Sockets disconnecting in Docker for Windows ...
I am struggling to find out why socket disconnects after 5 mins everytime. I finally find out the answer. Answer is : Port...
Read more >
Working with Visual Studio Code on Ubuntu on WSL2
1. Overview. Windows Subsystem for Linux (WSL) allows you to leverage the benefits of Linux package management and command line tools to streamline...
Read more >
WSL2 X11 programs "disappear" - windows 10 - Super User
It works fine for a while, but after my computer wakes up from sleep, the X window is gone. The application is still...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found