bitmagnet-io / bitmagnet

A self-hosted BitTorrent indexer, DHT crawler, content classifier and torrent search engine with web UI, GraphQL API and Servarr stack integration.
https://bitmagnet.io/
MIT License
1.96k stars 74 forks source link

tmdb_client context deadline exceeded | Infinite loop, doesn't work. Version 0.7.10-12 #211

Closed Neikon closed 2 months ago

Neikon commented 2 months ago

Describe the bug

After update, my bitmagnet docker doesn't work. It enters a loop asking tmdb API without results.

INFO    migrator        migrations/migrator.go:68       checking and applying migrations...
INFO    migrator        migrations/logger.go:33 goose: no migrations to run. current version: 16
INFO    worker/worker.go:195    started worker  {"key": "http_server"}
INFO    worker/worker.go:195    started worker  {"key": "dht_crawler"}
WARN    tmdb_client     v2@v2.11.0/request.go:949       Get "https://api.themoviedb.org/3/authentication?api_key=**********************": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 1
WARN    tmdb_client     v2@v2.11.0/request.go:949       Get "https://api.themoviedb.org/3/authentication?api_key=**********************": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 2
WARN    tmdb_client     v2@v2.11.0/request.go:949       Get "https://api.themoviedb.org/3/authentication?api_key=**********************": context deadline exceeded (Client.Timeout exceeded while awaiting headers), Attempt 3

ERROR   tmdb_client     v2@v2.11.0/request.go:963       Get "https://api.themoviedb.org/3/authentication?api_key=**********************": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
github.com/go-resty/resty/v2.(*Request).Execute
        /go/pkg/mod/github.com/go-resty/resty/v2@v2.11.0/request.go:963
github.com/go-resty/resty/v2.(*Request).Get
        /go/pkg/mod/github.com/go-resty/resty/v2@v2.11.0/request.go:852
github.com/bitmagnet-io/bitmagnet/internal/tmdb.client.request
        /build/internal/tmdb/client.go:127
github.com/bitmagnet-io/bitmagnet/internal/tmdb.client.ValidateApiKey
        /build/internal/tmdb/client.go:29
github.com/bitmagnet-io/bitmagnet/internal/tmdb.newClient
        /build/internal/tmdb/factory.go:55
github.com/bitmagnet-io/bitmagnet/internal/tmdb.New.func1
        /build/internal/tmdb/factory.go:30
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/classifier/video/tmdb.New.func1
        /build/internal/classifier/video/tmdb/factory.go:30
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/classifier/video.New.func1
        /build/internal/classifier/video/factory.go:23
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/classifier.New.func1
        /build/internal/classifier/factory.go:26
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/processor.New.func1
        /build/internal/processor/factory.go:37
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/processor/queue/handler.New.func1
        /build/internal/processor/queue/handler/handler.go:29
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/queue/server.New.func1
        /build/internal/queue/server/factory.go:45
github.com/bitmagnet-io/bitmagnet/internal/processor/queue/decorator.New.func1.1
        /build/internal/processor/queue/decorator/0.5.0_upgrade.go:103
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/worker.(*registry).Start
        /build/internal/boilerplate/worker/worker.go:189
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/app/cmd/worker.New.func1
        /build/internal/boilerplate/app/cmd/worker/command.go:42
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:279
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:272
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:272
github.com/urfave/cli/v2.(*App).RunContext
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:337
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/cli.New.func4.1
        /build/internal/boilerplate/cli/cli.go:53
ERROR   tmdb_client     tmdb/client.go:149      request failed  {"path": "/authentication", "queryParams": null, "status": "", "trace": {"DNSLookup":2389378,"ConnTime":0,"TCPConnTime":9998478619,"TLSHandshake":0,"ServerTime":0,"ResponseTime":0,"TotalTime":10000839313,"IsConnReused":false,"IsConnWasIdle":false,"ConnIdleTime":0,"RequestAttempt":4,"RemoteAddr":null}, "error": "Get \"https://api.themoviedb.org/3/authentication?api_key=**********************\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
github.com/bitmagnet-io/bitmagnet/internal/tmdb.client.request
        /build/internal/tmdb/client.go:149
github.com/bitmagnet-io/bitmagnet/internal/tmdb.client.ValidateApiKey
        /build/internal/tmdb/client.go:29
panic: Get "https://api.themoviedb.org/3/authentication?api_key=**********************": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

goroutine 13 [running]:
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/cli.New.func4.1()
        /build/internal/boilerplate/cli/cli.go:54 +0x47
created by github.com/bitmagnet-io/bitmagnet/internal/boilerplate/cli.New.func4 in goroutine 12
        /build/internal/boilerplate/cli/cli.go:52 +0xb8
github.com/bitmagnet-io/bitmagnet/internal/tmdb.newClient
        /build/internal/tmdb/factory.go:55
github.com/bitmagnet-io/bitmagnet/internal/tmdb.New.func1
        /build/internal/tmdb/factory.go:30
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/classifier/video/tmdb.New.func1
        /build/internal/classifier/video/tmdb/factory.go:30
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/classifier/video.New.func1
        /build/internal/classifier/video/factory.go:23
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/classifier.New.func1
        /build/internal/classifier/factory.go:26
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/processor.New.func1
        /build/internal/processor/factory.go:37
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/processor/queue/handler.New.func1
        /build/internal/processor/queue/handler/handler.go:29
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/lazy.(*lazy[...]).Get
        /build/internal/boilerplate/lazy/lazy.go:27
github.com/bitmagnet-io/bitmagnet/internal/queue/server.New.func1
        /build/internal/queue/server/factory.go:45
github.com/bitmagnet-io/bitmagnet/internal/processor/queue/decorator.New.func1.1
        /build/internal/processor/queue/decorator/0.5.0_upgrade.go:103
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/worker.(*registry).Start
        /build/internal/boilerplate/worker/worker.go:189
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/app/cmd/worker.New.func1
        /build/internal/boilerplate/app/cmd/worker/command.go:42
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:279
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:272
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:272
github.com/urfave/cli/v2.(*App).RunContext
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:337
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/cli.New.func4.1
        /build/internal/boilerplate/cli/cli.go:53
ERROR   worker/worker.go:190    error starting worker   {"key": "queue_server", "error": "Get \"https://api.themoviedb.org/3/authentication?api_key=**********************\": context deadline exceeded (Client.Timeout exceeded while awaiting headers)"}
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/worker.(*registry).Start
        /build/internal/boilerplate/worker/worker.go:190
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/app/cmd/worker.New.func1
        /build/internal/boilerplate/app/cmd/worker/command.go:42
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:279
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:272
github.com/urfave/cli/v2.(*Command).Run
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:272
github.com/urfave/cli/v2.(*App).RunContext
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:337
github.com/bitmagnet-io/bitmagnet/internal/boilerplate/cli.New.func4.1
        /build/internal/boilerplate/cli/cli.go:53
 *  Terminal will be reused by tasks, press any key to close it. 

Note: I hide the api key but is a personal key not the default one

To Reproduce

update to latest docekr image version 0.7.10-12

Environment Information (Required)

mgdigital commented 2 months ago

Hi, I'm not seeing this myself. It's possible that either TMDB had some downtime, or you had a network issue?

Can you confirm if this happens consistently, and also with the default API key?

BTW I'd expect it to retry 3 times then give up, rather than enter an infinite loop.

Neikon commented 2 months ago

Hi, I have created my API key just to try to solve this. I have the same error with the default one.

Everything was working this morning in v0.7.9, but I saw that .10 came out with "Show version info on webui" and I wanted to test it and after updating I saw that it took a long time to enter the webiu and when I went to the logs I found this error.

Could be a network error, but I don't touch anything only docker compose pull && docker compose up -d How can I test that? P.D: can I load 0.7.9 only setting that in dockercompose.yml, or I need to do something more to downgrade?

mgdigital commented 2 months ago

I'd try restarting everything (your machine, Docker etc). If you're using VPN maybe there was an issue with that.

BTW in future you can upgrade like this which will only touch the bitmagnet container:

docker compose down bitmagnet
docker pull ghcr.io/bitmagnet-io/bitmagnet:latest
docker compose up -d bitmagnet

I'm not 100% ruling out that there's an issue, but it seems unlikely as the TMDB stuff hasn't been touched in the last couple of versions, and no-one else has reported this.

Neikon commented 2 months ago

reboot again docker compose down docker image prune docker compose up -d

All works now 🤷‍♂️

Thank you!!