Cazzar / VTubeStudio-StreamDeck

16 stars 3 forks source link

Exception error on computer shutdown #26

Closed pixelvertice closed 1 year ago

pixelvertice commented 1 year ago

Every time I shut down or restart my PC sometimes Streamdeck-Vtubestudio process throws an error message, despite I don't have Vtube Studio running. Here's what I see at Event Viewer

Application: streamdeck-vtubestudio.exe
CoreCLR Version: 5.0.1722.21314
.NET Version: 5.0.17
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
 ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
 ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
   at System.Net.Http.HttpConnection.ReadBufferedAsyncCore(Memory`1 destination)
   at System.Net.Http.HttpConnection.RawConnectionStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken, Boolean throwOnPrematureClosure)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TWebSocketReceiveResultGetter,TWebSocketReceiveResult](Memory`1 payloadBuffer, CancellationToken cancellationToken, TWebSocketReceiveResultGetter resultGetter)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TWebSocketReceiveResultGetter,TWebSocketReceiveResult](Memory`1 payloadBuffer, CancellationToken cancellationToken, TWebSocketReceiveResultGetter resultGetter)
   at StreamDeckLib.StreamDeckConnection.ReceiveAsync()
   at StreamDeckLib.StreamDeckConnection.Run()
   at StreamDeckLib.StreamDeckHostedService.OnStarted()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_1(Object state)
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Cazzar commented 1 year ago

Thanks for the information, what this would be related to is the StreamDeck connection itself isn't actually closing in the "proper" way on a PC shutdown.

I will have a look at some ways this can be handled in a more graceful manner to not generate the error log.

Cazzar commented 1 year ago

untested as I have yet to try it on my own side,but https://github.com/Cazzar/VTubeStudio-StreamDeck/releases/tag/2.0.1 may fix the issue, will be testing it within the next 24-48 hours locally

Cazzar commented 1 year ago

https://github.com/Cazzar/VTubeStudio-StreamDeck/releases/tag/2.0.2 has fixed this issue, let me know if there are any further issues.

I have monitored locally after fixing this issue and it is not showing any errors on shutdown/force closure of the Streamdeck host application.