disnake icon indicating copy to clipboard operation
disnake copied to clipboard

Traceback on VoiceChannel.connect(), Socket not closing properly ?

Open arbaes opened this issue 3 years ago • 0 comments

Summary

I get AttributeError: '_MissingSentinel' object has no attribute 'close' when trying to connect to a voice channel

Reproduction Steps

Connect to a voice channel, get the voice protocol with

disnake.VoiceChannel.connect()

You'll get the traceback provided below

Minimal Reproducible Code

async def on_voice_state_update(self, member, before, after):
    vch = after.channel
    vp = await vch.connect()

Expected Results

No traceback, websocket properly closed

Actual Results

Warning + disnake Error

/home/user/.pyenv/versions/wheatley/lib/python3.8/site-packages/disnake/voice_client.py:329: ResourceWarning: unclosed <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_DGRAM, proto=0, laddr=('0.0.0.0', 0)>
  self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
2022-04-21 14:54:12,803 ERROR [disnake.state]: Exception occurred during Voice Protocol voice server update handler
Traceback (most recent call last):
  File "/home/user/.pyenv/versions/wheatley/lib/python3.8/site-packages/disnake/state.py", line 160, in logging_coroutine
    await coroutine
  File "/home/user/.pyenv/versions/wheatley/lib/python3.8/site-packages/disnake/voice_client.py", line 334, in on_voice_server_update
    await self.ws.close(4000)
AttributeError: '_MissingSentinel' object has no attribute 'close'
/home/user/.pyenv/versions/wheatley/lib/python3.8/site-packages/disnake/player.py:242: ResourceWarning: unclosed file <_io.BufferedReader name=12>
  self._process = self._stdout = self._stdin = MISSING
ResourceWarning: Enable tracemalloc to get the object allocation traceback

Intents

disnake.Intents(guild_messages=True, guild_reactions=True, guilds=True, voice_states=True)

System Information

- Python v3.8.10-final
- disnake v2.4.0-final
    - disnake pkg_resources: v2.4.0
- aiohttp v3.8.1
- system info: Linux 5.15.32-1-MANJARO #1 SMP PREEMPT Mon Mar 28 09:16:36 UTC 2022

Checklist

  • [X] I have searched the open issues for duplicates.
  • [X] I have shown the entire traceback, if possible.
  • [X] I have removed my token from display, if visible.

Additional Context

I'm fairly new with the Discord API for voice channel, maybe I'm doing something wrong ?

arbaes avatar Apr 21 '22 13:04 arbaes