ShokoAnime / ShokoServer

Repository for Shoko Server.
https://shokoanime.com/
MIT License
405 stars 74 forks source link

Docker not working due to HTTP timeouts trying to ping Google Analytics. #924

Closed FinalDoom closed 2 years ago

FinalDoom commented 2 years ago

VERSION INFORMATION

Server Version: docker shokoanime/server:latest, 4.1.1, 4.1.0, 4.0.1, 4.0.0

Desktop Version: n/a

LOG FILE

Docker log for all above 4.0.1:

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(Func`3 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 Shoko.Server.Utilities.Analytics.PostData(String type, IDictionary`2 extraData) in /usr/src/app/source/Shoko.Server/Utilities/Analytics.cs:line 68
   at Shoko.Server.Utilities.Analytics.PostEvent(String eventCategory, String eventAction, String eventLabel) in /usr/src/app/source/Shoko.Server/Utilities/Analytics.cs:line 30
   at Shoko.Server.Server.ShokoServer.StartUpServer() in /usr/src/app/source/Shoko.Server/Server/ShokoServer.cs:line 214
   at Shoko.CLI.Worker.ExecuteAsync(CancellationToken stoppingToken) in /usr/src/app/source/Shoko.CLI/Worker.cs:line 39
   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 Shoko.CLI.Program.Main(String[] args) in /usr/src/app/source/Shoko.CLI/Program.cs:line 17
Aborted

Log for 4.0.1, 4.0.0:

Unhandled exception. System.Threading.Tasks.TaskCanceledException: The operation was canceled.
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Shoko.Server.Utilities.Analytics.PostData(String type, IDictionary`2 extraData) in /usr/src/app/source/Shoko.Server/Utilities/Analytics.cs:line 71
   at Shoko.Server.Utilities.Analytics.PostEvent(String eventCategory, String eventAction, String eventLabel) in /usr/src/app/source/Shoko.Server/Utilities/Analytics.cs:line 30
   at Shoko.Server.Server.ShokoServer.StartUpServer() in /usr/src/app/source/Shoko.Server/Server/ShokoServer.cs:line 215
   at Shoko.CLI.Worker.ExecuteAsync(CancellationToken stoppingToken) in /usr/src/app/source/Shoko.CLI/Worker.cs:line 39
   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 Shoko.CLI.Program.Main(String[] args) in /usr/src/app/source/Shoko.CLI/Program.cs:line 18
Aborted

DESCRIPTION

After updating at some point in the last week or two, I get the first log no matter what I do--fresh install, fresh machine, etc. Centos and debian docker both, fresh and previously working data files.

Log is from latest and 4.0.1 respectively, so line numbers might differ for the other versions, but the message/error is the same otherwise.

STEPS TO REPRODUCE

No clue.

Dockerfile:

---
version: "3.7"

services:
  shoko:
    image: shokoanime/server:v4.0.0
    environment:
      - PUID=1000
      - PGID=1000
    networks:
      - bridge
    expose:
      - 8111
    labels:
      - "traefik.http.routers.shokoanime.tls=true"
      - "traefik.http.routers.shokoanime-http.tls=false"
    volumes:
      - shoko_data:/home/shoko/.shoko
      - /mnt/media:/mnt/media
    restart: "no"

networks:
  bridge:
    external:
      name: user_bridge

volumes:
  shoko_data:

Shoko is behind traefik reverse proxy that exposes https on 443 and http/whatever on 8111 (because the desktop app will not work with any other port/https configuration I guess).

It was working, connected to my plex/anidb, and everything is broken after updating from version ???? to latest.

Pretty lost really, I'd welcome any ideas how to get it to work. Ditching shoko and going back to shitty Plex matching is not high on my list, but nothing shows up without Shoko when using its metadata plugin so.......

Thanks.

FinalDoom commented 2 years ago

Okay so something clicked reading the stacktraces again. I run pfBlockerNG (pihole, whatever) network based ad-blocking, which blocks Google analytics.

Ideally, analytics polls should be formally optional for the application (opt-in for GPDR and so on really). But either way, a failure to poll google analytics should not prevent the application from starting. It starts fine when I turn off the blocking, but that's not something I'm interested in doing as a regular occurrence. And future polls will be blocked.. so hopefully they don't crash it too.

Cazzar commented 2 years ago

We made the decision around this to just remove it a couple of weeks back in https://github.com/ShokoAnime/ShokoServer/commit/f1df639ccc1a9f73944e762a7c1017929e83efab since we don’t use it, the latest daily has these changes

ideally (and from initial tests on implementation) it shouldn’t have thrown these errors and just ignored them

FinalDoom commented 2 years ago

Sounds good, thanks for following up!