rivenmedia / riven

Handle your Media Library with ease!
https://rivenmedia.github.io/wiki/
GNU General Public License v3.0
323 stars 47 forks source link

Torrentio broken / PostgreSQL database upgrade failed #722

Closed profucius closed 6 days ago

profucius commented 6 days ago

As of v0.14.1, perhaps prior.

Enabling Torrentio as a scraper and then clicking Save will cause Riven backend to crash. Log below immediately after clicking Save after enabling Torrentio.

Sep 23, 2024 23:07:25 - ERROR - PostgreSQL subprocess: type "states" does not exist
Sep 23, 2024 23:07:25 - INFO - PostgreSQL subprocess: 2024-09-24 04:07:25.712 UTC [154] STATEMENT:  ALTER TABLE "MediaItem" ALTER COLUMN last_state TYPE states
Sep 23, 2024 23:07:25 - WARNING - riven_backend subprocess: | db.run_migrations - Error running migrations: (psycopg2.errors.UndefinedObject) type "states" does not exist
Sep 23, 2024 23:07:25 - INFO - riven_backend subprocess: [SQL: ALTER TABLE "MediaItem" ALTER COLUMN last_state TYPE states ]
Sep 23, 2024 23:07:25 - INFO - riven_backend subprocess: (Background on this error at: https://sqlalche.me/e/20/f405)
Sep 23, 2024 23:07:25 - INFO - riven_backend subprocess: Generating /riven/backend/data/alembic/2024_09_23_e516510a4cec_auto_upg_20240923230725.py ...  done
Sep 23, 2024 23:07:26 - ERROR - PostgreSQL subprocess: type "states" does not exist
Sep 23, 2024 23:07:26 - INFO - PostgreSQL subprocess: 2024-09-24 04:07:26.001 UTC [154] STATEMENT:  ALTER TABLE "MediaItem" ALTER COLUMN last_state TYPE states
Sep 23, 2024 23:07:26 - WARNING - riven_backend subprocess: | db.run_migrations - Error running migrations: (psycopg2.errors.UndefinedObject) type "states" does not exist
Sep 23, 2024 23:07:26 - INFO - riven_backend subprocess: [SQL: ALTER TABLE "MediaItem" ALTER COLUMN last_state TYPE states ]
Sep 23, 2024 23:07:26 - INFO - riven_backend subprocess: (Background on this error at: https://sqlalche.me/e/20/f405)
Sep 23, 2024 23:07:26 - INFO - riven_backend subprocess: Generating /riven/backend/data/alembic/2024_09_23_ae729a70565c_auto_upg_20240923230725.py ...  done
Sep 23, 2024 23:07:26 - CRITICAL - riven_backend subprocess: | main.<module> - Server has been stopped
Sep 23, 2024 23:07:27 - INFO - riven_backend subprocess: | 👾 API       | main.dispatch - GET /settings/load - 200 - 2.62s
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: TypeError: fetch failed
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: at node:internal/deps/undici/undici:12500:13
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: [cause]: Error: connect ECONNREFUSED 127.0.0.1:8080
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16) {
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: errno: -111,
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: code: 'ECONNREFUSED',
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: syscall: 'connect',
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: address: '127.0.0.1',
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: port: 8080
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: }
Sep 23, 2024 23:07:27 - INFO - riven_frontend subprocess: }
Sep 23, 2024 23:07:30 - INFO - PostgreSQL subprocess: checkpoint starting: time
Sep 23, 2024 23:07:31 - INFO - PostgreSQL subprocess: checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.012 s, sync=0.024 s, total=1.063 s; sync files=9, longest=0.019 s, average=0.003 s; distance=31 kB, estimate=31 kB; lsn=0/681F11C8, redo lsn=0/681F1190
Sep 23, 2024 23:07:36 - ERROR - The Riven backend process is not running.
Sep 23, 2024 23:08:36 - ERROR - The Riven backend process is not running.
Sep 23, 2024 23:09:36 - ERROR - The Riven backend process is not running.

After restarting the stack in portainer, the error logs loop on retries, fail, then shutdown itself.

Sep 23, 2024 23:11:52 - ERROR - Error loading Riven settings: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /settings/save (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x71a6e34ae010>: Failed to establish a new connection: [Errno 111] Connection refused'))
Sep 23, 2024 23:11:52 - INFO - Retrying in 5 seconds... (1/10)
Sep 23, 2024 23:11:52 - INFO - riven_backend subprocess: | 👾 API       | main.dispatch - POST /settings/set - 200 - 3.91s
Sep 23, 2024 23:11:57 - ERROR - Error loading Riven settings: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /settings/set (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x71a6e34afbd0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Sep 23, 2024 23:11:57 - INFO - Retrying in 5 seconds... (2/10)
Sep 23, 2024 23:12:02 - ERROR - Error loading Riven settings: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /settings/set (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x71a6e3482c90>: Failed to establish a new connection: [Errno 111] Connection refused'))
Sep 23, 2024 23:12:02 - INFO - Retrying in 5 seconds... (3/10)
Sep 23, 2024 23:12:07 - ERROR - Error loading Riven settings: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /settings/set (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x71a6e3485a50>: Failed to establish a new connection: [Errno 111] Connection refused'))
...
...
Sep 23, 2024 23:12:32 - INFO - Retrying in 5 seconds... (9/10)
Sep 23, 2024 23:12:37 - ERROR - Error loading Riven settings: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /settings/set (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x71a6e3487250>: Failed to establish a new connection: [Errno 111] Connection refused'))
Sep 23, 2024 23:12:37 - ERROR - Error loading Riven settings: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /settings/set (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x71a6e3487250>: Failed to establish a new connection: [Errno 111] Connection refused'))
Sep 23, 2024 23:12:37 - ERROR - An error occurred in the Riven backend setup: HTTPConnectionPool(host='127.0.0.1', port=8080): Max retries exceeded with url: /settings/set (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x71a6e3487250>: Failed to establish a new connection: [Errno 111] Connection refused'))
Sep 23, 2024 23:12:37 - INFO - Shutdown signal received. Cleaning up...
Sep 23, 2024 23:12:37 - INFO - Stopping riven_frontend
Sep 23, 2024 23:12:37 - WARNING - riven_frontend process not found or already stopped.
Sep 23, 2024 23:12:37 - INFO - Stopping riven_backend
Sep 23, 2024 23:12:37 - INFO - riven_backend process terminated gracefully.
Sep 23, 2024 23:12:37 - INFO - Stopping Zilean
Sep 23, 2024 23:12:37 - WARNING - Zilean process not found or already stopped.
Sep 23, 2024 23:12:37 - INFO - Stopping PostgreSQL
Sep 23, 2024 23:12:37 - INFO - PostgreSQL subprocess: received smart shutdown request
Sep 23, 2024 23:12:37 - INFO - PostgreSQL subprocess: background worker "logical replication launcher" (PID 49) exited with exit code 1
Sep 23, 2024 23:12:37 - INFO - PostgreSQL subprocess: shutting down
Sep 23, 2024 23:12:37 - INFO - PostgreSQL subprocess: checkpoint starting: shutdown immediate
Sep 23, 2024 23:12:37 - INFO - PostgreSQL subprocess: checkpoint complete: wrote 9 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.010 s, sync=0.012 s, total=0.047 s; sync files=8, longest=0.005 s, average=0.002 s; distance=24 kB, estimate=24 kB; lsn=0/681F7458, redo lsn=0/681F7458
Sep 23, 2024 23:12:37 - INFO - PostgreSQL subprocess: database system is shut down
Sep 23, 2024 23:12:37 - INFO - PostgreSQL process terminated gracefully.
Sep 23, 2024 23:12:37 - INFO - Stopping Zurg
Sep 23, 2024 23:12:37 - INFO - Zurg process terminated gracefully.
Sep 23, 2024 23:12:37 - INFO - Stopping rclone
Sep 23, 2024 23:12:37 - ERROR - rclone mount name "DMB": /data/DMB: Unmounted rclone mount
Sep 23, 2024 23:12:37 - INFO - rclone process terminated gracefully.
Sep 23, 2024 23:12:37 - INFO - Shutdown complete.
dreulavelle commented 6 days ago

Please update to the latest. Should hopefully solve this. :)

dreulavelle commented 6 days ago

oh you have different issue. Looks like a service can't connect. You'll need to find out what the host/port should be in the DMB discord.

dreulavelle commented 6 days ago

This isnt a Torrentio issue anymore.

profucius commented 4 days ago

Just to add a note here for anyone who has this same issue: I resolved it with the diagnostic help of PUID on the DMB ticket mentioned above.

The issue was that the PostgreSQL database was not properly upgraded after the recent major Riven update/change. Somehow that was causing an issue enabling Torrentio, it would cause the whole stack to fail.

The solution was to delete the entire PostgreSQL/data folder and restart the stack. This erased my entire Riven Library, but did allow Torrentio to activate and now everything is working properly.