discord-net / Discord.Net

An unofficial .Net wrapper for the Discord API (https://discord.com/)
https://discordnet.dev
MIT License
3.34k stars 737 forks source link

VoiceBuffer freezes when not being able to resolve an overflow #218

Closed ghost closed 8 years ago

ghost commented 8 years ago

On my development machine everything works fine but as soon as I upload the program to a server in a firewalled environment it hangs in VoiceBuffer.cs on line 56.

_notOverflowEvent.Wait(cancelToken);

It does so indefinitely so I changed the code to

_notOverflowEvent.Wait(TimeSpan.FromMinutes(1), cancelToken);

To at least throw an exception. I've whitelisted my application in the Windows firewall and turned off UDP DDOS mitigation. Furthermore, opened ports 50.000 to 65535 UDP just to be sure.

I am not able to debug on the server right now. I realize it might be hard to resolve like this, merely looking for ideas on where to look. Once I have time I can set up a development environment on the server itself to see what's up. I've found above by turning on logging and forcing a disconnect. It returned the following exception:

System.OperationCanceledException: Client is disconnected. ---> System.OperationCanceledException: The operation was canceled.

   at System.Threading.CancellationToken.ThrowOperationCanceledException()

   at System.Threading.ManualResetEventSlim.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)

   at Discord.Audio.VoiceBuffer.Push(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancelToken) in Discord.Net.Audio\VoiceBuffer.cs:line 56

   --- End of inner exception stack trace ---

   at Discord.Audio.VoiceBuffer.Push(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancelToken) in Discord.Net.Audio\VoiceBuffer.cs:line 60

   at Discord.Audio.AudioClient.Send(Byte[] data, Int32 offset, Int32 count) in Discord.Net.Audio\AudioClient.cs:line 240
khionu commented 8 years ago

Given this is a 0.9.x issue, I don't think we're going to fix it, as we're putting all our efforts into 1.0.