-
Notifications
You must be signed in to change notification settings - Fork 25
SynoAI not running or stopping and not accessible from Surveillance Station #67
Description
Hi there,
I have this issue where SynoAI is not starting up when using an internal ip to connect to the synology. The container will stop eventually.
When i use config:
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Debug"
}
},
"Url": "http://internalip:5000",
"User": "",
"Password": "",
"MinSizeX": 100,
"MinSizeY": 100,
......
The log output is:
info: SynoAI.Startup[0]
Processing config.
info: SynoAI.Startup[0]
Processing camera config.
info: SynoAI.Startup[0]
Processing notifier config.
info: SynoAI.Startup[0]
Processing Webhook Config
info: SynoAI.Services.SynologyService[0]
Initialising
info: SynoAI.Services.SynologyService[0]
API: Querying end points
fail: SynoAI.Services.SynologyService[0]
An unhandled exception occurred initialising SynoAI. Exiting...
System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
at System.Net.Http.ConnectHelper.ConnectAsync(Func3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, 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.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken) at SynoAI.Services.SynologyService.GetEndPointsAsync() in /src/Services/SynologyService.cs:line 64 at SynoAI.Services.SynologyService.InitialiseAsync() in /src/Services/SynologyService.cs:line 285 info: Microsoft.Hosting.Lifetime[0] Application is shutting down... crit: Microsoft.AspNetCore.Server.Kestrel[0] Unable to start Kestrel. System.Threading.Tasks.TaskCanceledException: A task was canceled. at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication1 application, CancellationToken cancellationToken)
Unhandled exception. System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at SynoAI.Program.Main(String[] args) in /src/Program.cs:line 16
When i use this config (external url):
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Debug"
}
},
"Url": "https://externalurl.com",
"User": "",
"Password": "",
"MinSizeX": 100,
"MinSizeY": 100,
......
When i use external url it connects for a while. Altough i can access the webhook url within the browser, in the meantime surveillance station cannot acces the webhook URL on internal IP. Test will fail. Eventually the container stops.
The log output is:
SynoAI.Startup[0]
Processing config.
info: SynoAI.Startup[0]
Processing camera config.
info: SynoAI.Startup[0]
Processing notifier config.
info: SynoAI.Startup[0]
Processing Webhook Config
info: SynoAI.Services.SynologyService[0]
Initialising
info: SynoAI.Services.SynologyService[0]
API: Querying end points
dbug: SynoAI.Services.SynologyService[0]
API: Found path 'entry.cgi' for SYNO.API.Auth
dbug: SynoAI.Services.SynologyService[0]
API: Found path 'entry.cgi' for SYNO.SurveillanceStation.Camera
info: SynoAI.Services.SynologyService[0]
API: Successfully mapped all end points
info: SynoAI.Services.SynologyService[0]
Login: Authenticating
dbug: SynoAI.Services.SynologyService[0]
Login: Logging in (webapi/entry.cgi?api=SYNO.API.Auth&method=Login&version=6&account=***&passwd=>U&session=SurveillanceStation)
info: SynoAI.Services.SynologyService[0]
Login: Successful
info: SynoAI.Services.SynologyService[0]
GetCameras: Fetching Cameras
info: SynoAI.Services.SynologyService[0]
GetCameras: Successful. Found 1 cameras.
info: SynoAI.Services.SynologyService[0]
Initialisation successful.
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: /app
info: SynoAI.Controllers.CameraController[0]
Tuin: Motion detected, fetching snapshot.
dbug: SynoAI.Services.SynologyService[0]
Tuin: Found with Synology ID '3'.
dbug: SynoAI.Services.SynologyService[0]
Tuin: Taking snapshot from 'webapi/entry.cgi?version=9&id=3&api="SYNO.SurveillanceStation.Camera"&method=GetSnapshot&profileType=1'.
info: SynoAI.Services.SynologyService[0]
Tuin: Taking snapshot
dbug: SynoAI.Services.SynologyService[0]
Tuin: Reading snapshot
info: SynoAI.Controllers.CameraController[0]
Tuin: Snapshot received (864ms).
info: SynoAI.Controllers.CameraController[0]
Tuin: Processing.
dbug: SynoAI.Services.AIService[0]
Tuin: DeepStackAI: Sending image.
Unhandled exception. System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.
---> System.TimeoutException: The operation was canceled.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
at System.Net.Http.ConnectHelper.ConnectAsync(Func3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, 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.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken) at SynoAI.AIs.DeepStack.DeepStackAI.Process(ILogger logger, Camera camera, Byte[] image) in /src/AIs/DeepStack/DeepStackAI.cs:line 39 at SynoAI.Services.AIService.ProcessAsync(Camera camera, Byte[] image) in /src/Services/AIService.cs:line 24 at SynoAI.Controllers.CameraController.GetAIPredications(Camera camera, Byte[] imageBytes) in /src/Controllers/CameraController.cs:line 236 at SynoAI.Controllers.CameraController.Get(String id) in /src/Controllers/CameraController.cs:line 92 at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action1 callback, TState& state)
at System.Threading.QueueUserWorkItemCallback.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()