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

Cannot destroy VoiceConnection - it has already been destroyed #788

Closed
Yoinky3000 opened this issue Sep 18, 2021 · 2 comments
Closed

Cannot destroy VoiceConnection - it has already been destroyed #788

Yoinky3000 opened this issue Sep 18, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@Yoinky3000
Copy link
Contributor

Yoinky3000 commented Sep 18, 2021

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. Bot join voice channel
  2. Immediately disconnect the bot from voice channel before it start play track/ when bot playing track
  3. See error --> Cannot destroy VoiceConnection - it has already been destroyed (pop out after few moment)

Expected behavior

handler the error in try catch


**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->

**Please complete the following information:**
 - Node Version: 16.9.0
 - Discord Player Version: 5.1.0
 - Discord.js Version: 13.1.0

**Additional context**
<!-- Add any other context about the problem here. -->
@Yoinky3000 Yoinky3000 added the bug Something isn't working label Sep 18, 2021
@Yoinky3000
Copy link
Contributor Author

I found that the error caused by calling destroy in this code:

try {
    yield voice_1.entersState(this.voiceConnection, voice_1.VoiceConnectionStatus.Connecting, this.connectionTimeout);
}
catch (_a) {
    this.voiceConnection.destroy();
}

(located at dist\VoiceInterface\StreamDispatcher.js:55:46)
I think adding one more try catch inside the catch will solve the problem,like this:

try {
    yield voice_1.entersState(this.voiceConnection, voice_1.VoiceConnectionStatus.Connecting, this.connectionTimeout);
}
catch (_a) {
    try {
        this.voiceConnection.destroy();
    } catch (err) {
    }
}

@Yoinky3000
Copy link
Contributor Author

created pull request to fix this problem: #789

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant