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

bug: await VoiceClient.disconnect() raise OSError: [WinError 10038] when passing a str that represent a non file-like object #846

Open
3 tasks done
Snipy7374 opened this issue Nov 2, 2022 · 3 comments
Labels
unconfirmed bug Something might not be working

Comments

@Snipy7374
Copy link
Collaborator

Snipy7374 commented Nov 2, 2022

Summary

When using a FFmpegPCMAudio audio source with a source that represent a non file-like object (e.g a url) and when disconnecting from a VoiceChannel you get an OSError.

This bug was found while trying to test more

Reproduction Steps

Connect to a VoiceChannel
Start playing something using FFmpegPCMAudio as audio source with a source that does't represent a file-like object
Disconnect from the VoiceChannel using await VoiceClient.disconnect()

Minimal Reproducible Code

@bot.slash_command()
async def test(inter):
    channel: disnake.VoiceChannel = await bot.fetch_channel(874005538285977603)
    vc = await channel.connect()
    vc.play(disnake.FFmpegPCMAudio("https://github.com/ninjamuffin99/Funkin/blob/a083938ac803a91fbb15f03e432dea620f8a3b4a/assets/songs/bopeebo/Inst.mp3?raw=true", executable="C:\\Users\\user\\LMAOGOTIT\\Desktop\\ffmpeg-master-latest-win64-gpl-shared\\bin\\ffmpeg.exe"))
    print(f"playing: {vc.is_playing()} paused: {vc.is_paused()}")
    await asyncio.sleep(2)
    vc.stop()
    await vc.disconnect()

Expected Results

The bot should disconnect from the VoiceChannel succesfully without raising any error

Actual Results

The bot raise an error, full traceback below:

Exception in voice thread Thread-3
Traceback (most recent call last):
  File "C:\Coding prog\lib\site-packages\disnake\player.py", line 746, in run
    self._do_run()
  File "C:\Coding prog\lib\site-packages\disnake\player.py", line 739, in _do_run
    play_audio(data, encode=not self.source.is_opus())
  File "C:\Coding prog\lib\site-packages\disnake\voice_client.py", line 686, in send_audio_packet
    self.socket.sendto(packet, (self.endpoint_ip, self.voice_port))
OSError: [WinError 10038] an operation was attempted on something that is not a socket

Intents

Irrelevants

System Information

Windows 11 Version 21H2 -- Build SO 22000.1098
Disnake 2.7.0

Checklist

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

Additional Context

I think that the problem is related to the stream of bytes coming from FFmpeg or some bug/problem occurred while trying to stop the stream

@shiftinv
Copy link
Member

shiftinv commented Nov 2, 2022

Can't reproduce after several tries (Ubuntu 22.04, ffmpeg 4.4.2), how reliably does this occur for you?
Sounds like a (fairly harmless) race condition, in any case.

@Snipy7374
Copy link
Collaborator Author

Snipy7374 commented Nov 2, 2022

Can't reproduce after several tries (Ubuntu 22.04, ffmpeg 4.4.2), how reliably does this occur for you?
Sounds like a (fairly harmless) race condition, in any case.

mb, I think it probably only affects Windows users

tomorrow I'll update the issue with version informations

@Snipy7374
Copy link
Collaborator Author

I've added System informations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed bug Something might not be working
Projects
None yet
Development

No branches or pull requests

2 participants