Bluefissure / Dalamud-OBS

A Dalamud plugin to control obs
11 stars 10 forks source link

Websocket Errors in Dalamud xllog #24

Open raegx opened 4 months ago

raegx commented 4 months ago

These error messages occur on every startup for me.

10:48:04.348 | ERR | Unobserved exception in Task.
    System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (Failed to start Websocket client, error: 'Unable to connect to the remote server')
     ---> Websocket.Client.Exceptions.WebsocketException: Failed to start Websocket client, error: 'Unable to connect to the remote server'
     ---> System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server
     ---> System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (127.0.0.1:4455)
     ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
       at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
       at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
       at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
       at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken, ClientWebSocketOptions options)
       at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken, ClientWebSocketOptions options)
       at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, HttpMessageInvoker invoker, CancellationToken cancellationToken)
       at Websocket.Client.WebsocketClient.<>c.<<-ctor>b__17_0>d.MoveNext()
    --- End of stack trace from previous location ---
       at Websocket.Client.WebsocketClient.StartClient(Uri uri, CancellationToken token, ReconnectionType type, Boolean failFast)
       --- End of inner exception stack trace ---
       at Websocket.Client.WebsocketClient.StartClient(Uri uri, CancellationToken token, ReconnectionType type, Boolean failFast)
       at Websocket.Client.WebsocketClient.StartInternal(Boolean failFast)
       --- End of inner exception stack trace ---

As far as I know, this plugin is the only one that uses websockets.

Bluefissure commented 4 months ago

Please check your websocket plugin settings in your OBS, and also https://github.com/Bluefissure/Dalamud-OBS/issues/19

raegx commented 4 months ago

I see what the issue is.

I configured XIVLauncher to terminate OBS on close. However OBS does not like this and on next run will show a safe mode prompt before fully starting:

image

In this case, the stack trace above is output when FFXIV Loads. Additionally, once the above prompt is bypassed, another exception will occur:

14:03:09.004 | ERR | Unobserved exception in Task.
    System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (The requested name is valid, but no data of the requested type was found.)
     ---> System.Net.Sockets.SocketException (11004): The requested name is valid, but no data of the requested type was found.
       at System.Net.NameResolutionPal.ProcessResult(SocketError errorCode, GetAddrInfoExContext* context)
       at System.Net.NameResolutionPal.GetAddressInfoExCallback(Int32 error, Int32 bytes, NativeOverlapped* overlapped)
    --- End of stack trace from previous location ---
       at SonarUtils.HappyHttpUtils.PerformDnsAsync(List`1 entries, AddressFamily family, SocketsHttpConnectionContext context, CancellationToken cancellationToken) in /work/repo/SonarUtils/HappyHttpUtils.cs:line 100
       --- End of inner exception stack trace ---

The first attempt after this point will result in an authentication failure then a follow up attempt which will succeed.

The plugin does work in this scenario, it just doesn't appear to be handling the safe mode prompt edge case well.