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]: Application crashes with disconnects #2809

Open
3 tasks done
heinsenberg82 opened this issue Dec 15, 2023 · 1 comment
Open
3 tasks done

[Bug]: Application crashes with disconnects #2809

heinsenberg82 opened this issue Dec 15, 2023 · 1 comment
Labels

Comments

@heinsenberg82
Copy link

Check The Docs

  • I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • I verified the issue was caused by Discord.Net.

Check your intents

  • I double checked that I have the required intents.

Description

I'm using DiscordNet in a .NET 7 project, as an API background service. As far as I understand, disconnects and reconnects should be handled gracefully by the library. However, sometimes (very often, actually) my application crashes with this error:

[16:18:15 ERR] [WEBSOCKET CLIENT] Error while listening to websocket stream, error: 'The remote party closed the WebSocket connection without completing the close handshake.' <s:Websocket.Client.WebsocketClient>
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
   at System.Net.WebSockets.ManagedWebSocket.ThrowEOFUnexpected()
   at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---

Version

3.12.0

Working Version

No response

Logs

[16:18:15 ERR] [WEBSOCKET CLIENT] Error while listening to websocket stream, error: 'The remote party closed the WebSocket connection without completing the close handshake.' <s:Websocket.Client.WebsocketClient>
System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
   at System.Net.WebSockets.ManagedWebSocket.ThrowEOFUnexpected()
   at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TResult](Memory`1 payloadBuffer, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource<TResult>.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask`1.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---

Sample

No response

Packages

not applicable

Environment

Docker ("Debian GNU/Linux 11 (bullseye)") running on a Raspberry Pi 4

@Anu6is
Copy link
Contributor

Anu6is commented Dec 15, 2023

While DNet does throw this error, it should not crash your application. It could be something in your codebase that's causing it to crash, like an async void or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants