djdd87/SynoAI

Container stops when cannot connect to Webhook

JohannCR opened this issue · 2 comments

When Webhook is unreachable the container stops. If it is configured to restart automatically that can be a bit bothersome^^

Here is my log if it can help:

2023-02-17T11:34:31.949584663Z	stdout	   at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
2023-02-17T11:34:31.949544772Z	stdout	   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_1(Object state)
2023-02-17T11:34:31.949513928Z	stdout	   at SynoAI.Controllers.CameraController.Get(String id) in /src/Controllers/CameraController.cs:line 211
2023-02-17T11:34:31.949475913Z	stdout	   at SynoAI.Controllers.CameraController.SendNotifications(Camera camera, Notification notification) in /src/Controllers/CameraController.cs:line 447 
2023-02-17T11:34:31.949437433Z	stdout	   at SynoAI.Notifiers.Webhook.Webhook.SendAsync(Camera camera, Notification notification, ILogger logger) in /src/Notifiers/Webhook/Webhook.cs:line 128 
2023-02-17T11:34:31.949396207Z	stdout	   at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949363298Z	stdout	   at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949324593Z	stdout	   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949289776Z	stdout	   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949254512Z	stdout	   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949223989Z	stdout	   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949187701Z	stdout	   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949154459Z	stdout	   at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949119151Z	stdout	   --- End of inner exception stack trace ---
2023-02-17T11:34:31.949083956Z	stdout	   at System.Net.Http.ConnectHelper.ConnectAsync(Func`3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) 
2023-02-17T11:34:31.949042365Z	stdout	   at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken) 
2023-02-17T11:34:31.948996339Z	stdout	   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|283_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) 
2023-02-17T11:34:31.948951328Z	stdout	   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
2023-02-17T11:34:31.948897781Z	stdout	   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) 
2023-02-17T11:34:31.948178819Z	stdout	 ---> System.Net.Sockets.SocketException (111): Connection refused
2023-02-17T11:34:31.948001215Z	stdout	Unhandled exception. System.Net.Http.HttpRequestException: Connection refused

I can change it to capture the Exception, write out a friendly message to the log and then continue without dying.

Fixed in 1.2.2.