tgdrive / teldrive

Telegram Drive
MIT License
1.72k stars 251 forks source link

ERROR: prepared statement "stmtcache_ed3353f36c147626d1cfdec0226d5cf3f91b98f90848ff76" already exists (SQLSTATE 42P05) #310

Closed iwconfig closed 2 months ago

iwconfig commented 2 months ago

Hello,

to be able to upgrade teldrive, I've now migrated from Neon to Supabase, but i continue to encounter this error:

ERROR: prepared statement "stmtcache_ed3353f36c147626d1cfdec0226d5cf3f91b98f90848ff76" already exists (SQLSTATE 42P05)

I've also encountered SQLSTATE 26000, and also that relation "goose_db_version" already exists". Not sure if or how they're related to this. I've since then started over from scratch with a new migration to Supabase, but the SQLSTATE 42P05 still comes up.

I can access my files from the teldrive UI seemingly just fine, although an error or two might pop up from time to time when only browsing the files. When uploading/deleting they show up frequently. It's mostly the same statement it complains about, but sometimes there's another one as well. And rclone fails completely to get a file list.

I don't know what I'm doing wrong here. Where are these statements stored? Is this ~an error~a bug on my end?

Log ```console # docker compose logs -f -n20 teldrive | 17/07/2024 10:05 PM ERROR [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | [28.728ms] [rows:-] WITH "ranked_scores" AS (SELECT "name",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY name ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE name >= (SELECT name FROM ranked_scores WHERE rank = 1) AND (user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) ORDER BY "name" LIMIT 500 teldrive | 17/07/2024 10:05 PM ERROR ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | 17/07/2024 10:05 PM INFO {"status": 500, "method": "GET", "path": "/api/files", "query": "name=&op=find&path=%2F", "ip": "172.19.0.3", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.028965577, "time": "2024-07-17T20:05:45Z"} teldrive | 17/07/2024 10:05 PM ERROR [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | [28.870ms] [rows:-] WITH "ranked_scores" AS (SELECT "name",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY name ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE name >= (SELECT name FROM ranked_scores WHERE rank = 1) AND (user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) ORDER BY "name" LIMIT 500 teldrive | 17/07/2024 10:05 PM ERROR ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | 17/07/2024 10:05 PM INFO {"status": 500, "method": "GET", "path": "/api/files", "query": "name=&op=find&path=%2F", "ip": "172.19.0.3", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.029082384, "time": "2024-07-17T20:05:46Z"} teldrive | 17/07/2024 10:05 PM ERROR [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | [28.656ms] [rows:-] WITH "ranked_scores" AS (SELECT "name",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY name ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE name >= (SELECT name FROM ranked_scores WHERE rank = 1) AND (user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) ORDER BY "name" LIMIT 500 teldrive | 17/07/2024 10:05 PM ERROR ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | 17/07/2024 10:05 PM INFO {"status": 500, "method": "GET", "path": "/api/files", "query": "name=&op=find&path=%2F", "ip": "172.19.0.3", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.028903586, "time": "2024-07-17T20:05:46Z"} teldrive | 17/07/2024 10:05 PM ERROR [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | [56.957ms] [rows:-] WITH "ranked_scores" AS (SELECT "name",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY name ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE name >= (SELECT name FROM ranked_scores WHERE rank = 1) AND (user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) ORDER BY "name" LIMIT 500 teldrive | 17/07/2024 10:05 PM ERROR ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | 17/07/2024 10:05 PM INFO {"status": 500, "method": "GET", "path": "/api/files", "query": "name=&op=find&path=%2F", "ip": "172.19.0.3", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.057321338, "time": "2024-07-17T20:05:48Z"} teldrive | 17/07/2024 10:05 PM ERROR [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | [57.097ms] [rows:-] WITH "ranked_scores" AS (SELECT "name",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY name ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE name >= (SELECT name FROM ranked_scores WHERE rank = 1) AND (user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/', 6907387205))) ORDER BY "name" LIMIT 500 teldrive | 17/07/2024 10:05 PM ERROR ERROR: prepared statement "stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d" already exists (SQLSTATE 42P05) teldrive | 17/07/2024 10:05 PM INFO {"status": 500, "method": "GET", "path": "/api/files", "query": "name=&op=find&path=%2F", "ip": "172.19.0.3", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.057479245, "time": "2024-07-17T20:05:50Z"} teldrive_rclone_webdav | 2024/07/17 20:05:45 NOTICE: Config file "/config/rclone/rclone.conf" not found - using defaults teldrive_rclone_webdav | 2024/07/17 20:05:50 Failed to create file system for "teldrive:": HTTP error 500 (500 Internal Server Error) returned body: "{\"code\":500,\"message\":\"ERROR: prepared statement \\\"stmtcache_2328867a422afa7229b18e456fbe7132a75901cd11b8a33d\\\" already exists (SQLSTATE 42P05)\"}" ```
Log 2 ```console # docker compose down # docker compose up Attaching to teldrive, teldrive_rclone_webdav teldrive_rclone_webdav | 2024/07/17 20:29:25 NOTICE: Config file "/config/rclone/rclone.conf" not found - using defaults teldrive | 2024/07/17 22:29:25 goose: no migrations to run. current version: 20240715001936 teldrive | 17/07/2024 10:29 PM INFO Started server http://localhost:8080 teldrive | 17/07/2024 10:29 PM ERROR [DB] github.com/divyam234/teldrive/pkg/cron/cron.go:120 ERROR: prepared statement "stmtcache_4f7eb27a9c5de771fd67f023884673c0d00d03ce530b0de8" does not exist (SQLSTATE 26000) teldrive | [260.624ms] [rows:-] SELECT JSONB_AGG(uploads.part_id) as parts,uploads.channel_id,uploads.user_id,s.session FROM "teldrive"."uploads" left join teldrive.users as u on u.user_id = uploads.user_id left join (select * from teldrive.sessions order by created_at desc limit 1) as s on s.user_id = uploads.user_id WHERE uploads.created_at < '2024-07-10 20:29:25.573' GROUP BY "uploads"."channel_id","uploads"."user_id","s"."session" teldrive | 17/07/2024 10:29 PM INFO {"status": 200, "method": "GET", "path": "/api/auth/session", "query": "", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.08741136, "time": "2024-07-17T20:29:25Z"} teldrive | 17/07/2024 10:29 PM INFO {"status": 200, "method": "GET", "path": "/api/files", "query": "name=&op=find&path=%2F", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.105320544, "time": "2024-07-17T20:29:26Z"} teldrive_rclone_webdav | 2024/07/17 20:29:26 NOTICE: teldrive root '': WebDav Server started on [http://[::]:9898/] teldrive | 17/07/2024 10:29 PM INFO {"status": 200, "method": "GET", "path": "/api/files", "query": "limit=500&op=list&page=1&path=%2F&sort=id", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.098826746, "time": "2024-07-17T20:29:27Z"} teldrive | 17/07/2024 10:29 PM INFO {"status": 200, "method": "GET", "path": "/api/files", "query": "limit=500&op=list&page=1&path=%2Ftest&sort=id", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.066709467, "time": "2024-07-17T20:29:27Z"} teldrive | 17/07/2024 10:29 PM INFO {"status": 200, "method": "GET", "path": "/api/files", "query": "limit=500&op=list&page=1&path=%2Ffolder2&sort=id", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.064588087, "time": "2024-07-17T20:29:27Z"} teldrive | 17/07/2024 10:29 PM INFO {"status": 200, "method": "GET", "path": "/api/files", "query": "limit=500&op=list&page=1&path=%2Ffolder3&sort=id", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.067442974, "time": "2024-07-17T20:29:27Z"} teldrive | 17/07/2024 10:29 PM INFO {"status": 200, "method": "GET", "path": "/api/files", "query": "limit=500&op=list&page=1&path=%2Ffolder4&sort=id", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.167892281, "time": "2024-07-17T20:29:28Z"} teldrive | 17/07/2024 10:29 PM ERROR [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: prepared statement "stmtcache_ed3353f36c147626d1cfdec0226d5cf3f91b98f90848ff76" already exists (SQLSTATE 42P05) teldrive | [84.790ms] [rows:-] WITH "ranked_scores" AS (SELECT "id",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY id ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/folder1', 6907387205))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE id >= (SELECT id FROM ranked_scores WHERE rank = 1) AND (user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/folder1', 6907387205))) ORDER BY "id" LIMIT 500 teldrive | 17/07/2024 10:29 PM ERROR ERROR: prepared statement "stmtcache_ed3353f36c147626d1cfdec0226d5cf3f91b98f90848ff76" already exists (SQLSTATE 42P05) teldrive | 17/07/2024 10:29 PM INFO {"status": 500, "method": "GET", "path": "/api/files", "query": "limit=500&op=list&page=1&path=%2Ffolder1&sort=id", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.08509973, "time": "2024-07-17T20:29:28Z"} teldrive | 17/07/2024 10:29 PM ERROR [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: prepared statement "stmtcache_ed3353f36c147626d1cfdec0226d5cf3f91b98f90848ff76" already exists (SQLSTATE 42P05) teldrive | [28.732ms] [rows:-] WITH "ranked_scores" AS (SELECT "id",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY id ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/folder5', 6907387205))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE id >= (SELECT id FROM ranked_scores WHERE rank = 1) AND (user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/folder5', 6907387205))) ORDER BY "id" LIMIT 500 teldrive | 17/07/2024 10:29 PM ERROR ERROR: prepared statement "stmtcache_ed3353f36c147626d1cfdec0226d5cf3f91b98f90848ff76" already exists (SQLSTATE 42P05) teldrive | 17/07/2024 10:29 PM INFO {"status": 500, "method": "GET", "path": "/api/files", "query": "limit=500&op=list&page=1&path=%2Ffolder5&sort=id", "ip": "172.19.0.2", "user-agent": "rclone/v1.68.0-beta..", "latency": 0.028994798, "time": "2024-07-17T20:29:28Z"} teldrive | 17/07/2024 10:29 PM ERROR [DB] github.com/divyam234/teldrive/pkg/services/file.go:329 ERROR: prepared statement "stmtcache_ed3353f36c147626d1cfdec0226d5cf3f91b98f90848ff76" already exists (SQLSTATE 42P05) teldrive | [28.727ms] [rows:-] WITH "ranked_scores" AS (SELECT "id",count(*) OVER () as total,ROW_NUMBER() OVER (ORDER BY id ASC) AS rank FROM "teldrive"."files" WHERE user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/folder6', 6907387205))) SELECT *,(select total from ranked_scores limit 1) as total FROM "teldrive"."files" WHERE id >= (SELECT id FROM ranked_scores WHERE rank = 1) AND (user_id = 6907387205 AND status = 'active' AND parent_id in (SELECT id FROM teldrive.get_file_from_path('/folder6', 6907387205))) ORDER BY "id" LIMIT 500 teldrive | 17/07/2024 10:29 PM ERROR ERROR: prepared statement "stmtcache_ed3353f36c147626d1cfdec0226d5cf3f91b98f90848ff76" already exists (SQLSTATE 42P05) [...] ```

Here's the migration log. There are some errors here, and I'm not sure what to make of it.

psql log ```console # psql -d "$SUPABASE_DB_ADDR" -f dump.sql SET SET SET SET SET set_config ------------ (1 row) SET SET SET SET ALTER TABLE ALTER TABLE ALTER TABLE DROP INDEX DROP INDEX DROP INDEX DROP INDEX DROP INDEX DROP INDEX DROP INDEX DROP INDEX DROP INDEX DROP INDEX ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE DROP TABLE DROP TABLE DROP TABLE DROP TABLE DROP TABLE DROP SEQUENCE DROP TABLE DROP SEQUENCE DROP TABLE DROP PROCEDURE DROP FUNCTION DROP FUNCTION DROP FUNCTION DROP FUNCTION DROP FUNCTION DROP FUNCTION DROP FUNCTION DROP PROCEDURE DROP PROCEDURE DROP FUNCTION DROP TABLE DROP FUNCTION DROP FUNCTION psql:dump.sql:65: ERROR: cannot drop extension pgcrypto because other objects depend on it DETAIL: extension pgjwt depends on extension pgcrypto HINT: Use DROP ... CASCADE to drop the dependent objects too. DROP EXTENSION DROP COLLATION DROP SCHEMA COMMENT CREATE SCHEMA CREATE COLLATION psql:dump.sql:94: ERROR: absolute path not allowed CONTEXT: PL/pgSQL function inline_code_block line 3 at EXECUTE SQL statement "do $$ begin execute replace( replace( replace( replace( pg_read_file( '/etc/postgresql-custom/extension-custom-scripts/before-create.sql' ), '@extname@', '''btree_gin''' ), '@extschema@', '''public''' ), '@extversion@', 'null' ), '@extcascade@', 'false' ); exception when undefined_file then -- skip end $$" psql:dump.sql:101: ERROR: extension "btree_gin" does not exist CREATE EXTENSION COMMENT CREATE FUNCTION CREATE FUNCTION SET SET CREATE TABLE CREATE FUNCTION CREATE PROCEDURE CREATE PROCEDURE CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE FUNCTION CREATE PROCEDURE CREATE TABLE CREATE SEQUENCE ALTER SEQUENCE CREATE TABLE CREATE SEQUENCE ALTER SEQUENCE CREATE TABLE CREATE TABLE CREATE TABLE CREATE TABLE CREATE TABLE ALTER TABLE ALTER TABLE COPY 19 COPY 10 COPY 10 COPY 1 COPY 7384 COPY 1 COPY 11 COPY 1 setval -------- 19 (1 row) setval -------- 10 (1 row) ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE ALTER TABLE CREATE INDEX CREATE INDEX psql:dump.sql:8322: ERROR: data type timestamp without time zone has no default operator class for access method "gin" HINT: You must specify an operator class for the index or define a default operator class for the data type. CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX CREATE INDEX ALTER TABLE ALTER TABLE ALTER TABLE ```

Ok now I've downgraded to 1.4.5. Doesnt seem to solve it completely, the error comes up but not as much as before. It worked flawlessly at first start, however, after restarting the container i get the relation "goose_db_version" already exists (SQLSTATE 42P07) error again. Restarting the Supabase db solves it but if i stop and start the teldrive container once again the same issue happens. I mean.. I can't keep restarting the database each time.

Here's the log after restarting the teldrive container:

`docker compose up` log (restart) ```console # docker compose up server [+] Running 1/0 ✔ Container teldrive Created 0.0s Attaching to teldrive teldrive | panic: failed run migrate: ERROR: relation "goose_db_version" already exists (SQLSTATE 42P07) teldrive | teldrive | goroutine 1 [running]: teldrive | github.com/divyam234/teldrive/internal/database.NewDatabase(0xc00041c000) teldrive | github.com/divyam234/teldrive/internal/database/database.go:63 +0x4c5 teldrive | reflect.Value.call({0x183b8a0?, 0x20eda68?, 0x7c5d2a061868?}, {0x1be5c07, 0x4}, {0xc000010de0, 0x1, 0x7c5d70a92bb8?}) teldrive | reflect/value.go:596 +0xca6 teldrive | reflect.Value.Call({0x183b8a0?, 0x20eda68?, 0x411f65?}, {0xc000010de0?, 0x1990480?, 0xc00054d501?}) teldrive | reflect/value.go:380 +0xb9 teldrive | go.uber.org/dig.defaultInvoker({0x183b8a0?, 0x20eda68?, 0xc00016e3e0?}, {0xc000010de0?, 0x1?, 0x2300350?}) teldrive | go.uber.org/dig@v1.17.1/container.go:238 +0x25 teldrive | go.uber.org/dig.(*constructorNode).Call(0xc0004c09c0, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/constructor.go:185 +0x34a teldrive | go.uber.org/dig.paramSingle.Build({{0x0, 0x0}, 0x0, {0x2308588, 0x1bd2280}}, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/param.go:287 +0x34a teldrive | go.uber.org/dig.paramList.BuildList({{0x2308588, 0x1870ae0}, {0xc0005451d0, 0x3, 0x3}}, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/param.go:150 +0xad teldrive | go.uber.org/dig.(*constructorNode).Call(0xc0004c0d80, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/constructor.go:155 +0x137 teldrive | go.uber.org/dig.paramSingle.Build({{0x0, 0x0}, 0x0, {0x2308588, 0x1afb740}}, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/param.go:287 +0x34a teldrive | go.uber.org/dig.paramList.BuildList({{0x2308588, 0x18ab620}, {0xc000050f00, 0x4, 0x4}}, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/param.go:150 +0xad teldrive | go.uber.org/dig.(*constructorNode).Call(0xc0004c0fc0, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/constructor.go:155 +0x137 teldrive | go.uber.org/dig.paramSingle.Build({{0x0, 0x0}, 0x0, {0x2308588, 0x1ba18e0}}, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/param.go:287 +0x34a teldrive | go.uber.org/dig.paramList.BuildList({{0x2308588, 0x1870ba0}, {0xc00054cd80, 0x3, 0x3}}, {0x2300350, 0xc000152140}) teldrive | go.uber.org/dig@v1.17.1/param.go:150 +0xad teldrive | go.uber.org/dig.(*Scope).Invoke(0xc000152140, {0x1870ba0, 0x20eda58}, {0x0, 0x0, 0x31dade0?}) teldrive | go.uber.org/dig@v1.17.1/invoke.go:122 +0x318 teldrive | go.uber.org/dig.(*Container).Invoke(0x20?, {0x1870ba0?, 0x20eda58?}, {0x0?, 0xc000175600?, 0xc00050f6a0?}) teldrive | go.uber.org/dig@v1.17.1/invoke.go:82 +0x25 teldrive | go.uber.org/fx.runInvoke({0x7c5d2a071ac8?, 0xc000078660?}, {{0x1870ba0, 0x20eda58}, {0xc00013a3c0, 0x7, 0x8}}) teldrive | go.uber.org/fx@v1.22.1/invoke.go:109 +0x153 teldrive | go.uber.org/fx.(*module).executeInvoke(0xc0005405b0, {{0x1870ba0, 0x20eda58}, {0xc00013a3c0, 0x7, 0x8}}) teldrive | go.uber.org/fx@v1.22.1/module.go:320 +0x145 teldrive | go.uber.org/fx.(*module).executeInvokes(0xc0005405b0) teldrive | go.uber.org/fx@v1.22.1/module.go:306 +0xda teldrive | go.uber.org/fx.New({0xc00050fb08, 0x7, 0x0?}) teldrive | go.uber.org/fx@v1.22.1/app.go:517 +0x9fa teldrive | github.com/divyam234/teldrive/cmd.runApplication(0xc00041c000) teldrive | github.com/divyam234/teldrive/cmd/run.go:128 +0x612 teldrive | github.com/divyam234/teldrive/cmd.NewRun.func1(0xc0000ca600?, {0x1be5b67?, 0x4?, 0x1be5b6b?}) teldrive | github.com/divyam234/teldrive/cmd/run.go:45 +0x17 teldrive | github.com/spf13/cobra.(*Command).execute(0xc00043f808, {0xc0004af700, 0x2, 0x2}) teldrive | github.com/spf13/cobra@v1.8.1/command.go:989 +0xab1 teldrive | github.com/spf13/cobra.(*Command).ExecuteC(0xc00043f508) teldrive | github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff teldrive | github.com/spf13/cobra.(*Command).Execute(...) teldrive | github.com/spf13/cobra@v1.8.1/command.go:1041 teldrive | github.com/spf13/cobra.(*Command).ExecuteContext(0x22ddf30?, {0x22de0f0?, 0xc0004d4a80?}) teldrive | github.com/spf13/cobra@v1.8.1/command.go:1034 +0x47 teldrive | main.main() teldrive | ./main.go:15 +0x96 teldrive exited with code 0 ```

This won't go away unless i restart my database. Here's after restarting it:

`docker compose up` log during db restart ```console # docker compose up server [+] Running 1/0 ✔ Container teldrive Created 0.0s Attaching to teldrive teldrive | 18/07/2024 12:04 AM ERROR [DB] failed to initialize database, got error [driver: bad connection] teldrive | 18/07/2024 12:04 AM WARN failed to open database: driver: bad connection teldrive | 18/07/2024 12:04 AM ERROR [DB] failed to initialize database, got error [driver: bad connection] teldrive | 18/07/2024 12:04 AM WARN failed to open database: driver: bad connection teldrive | 18/07/2024 12:05 AM ERROR [DB] failed to initialize database, got error [driver: bad connection] teldrive | 18/07/2024 12:05 AM WARN failed to open database: driver: bad connection teldrive | 2024/07/18 00:05:52 goose: no migrations to run. current version: 20240615110350 teldrive | 18/07/2024 12:05 AM INFO Started server http://localhost:8080 teldrive | 18/07/2024 12:05 AM ERROR [DB] github.com/divyam234/teldrive/pkg/cron/cron.go:71 ERROR: prepared statement "stmtcache_5014926d4575f768102da05c118e722c9172b019b4af8fbc" does not exist (SQLSTATE 26000) teldrive | [302.064ms] [rows:-] SELECT JSONB_AGG(jsonb_build_object('id',files.id, 'parts',files.parts)) as files,files.channel_id,files.user_id,s.session FROM "teldrive"."files" left join teldrive.users as u on u.user_id = files.user_id left join (select * from teldrive.sessions order by created_at desc limit 1) as s on u.user_id = s.user_id WHERE type = 'file' AND status = 'pending_deletion' GROUP BY "files"."channel_id","files"."user_id","s"."session" teldrive | 18/07/2024 12:05 AM ERROR [DB] github.com/divyam234/teldrive/pkg/cron/cron.go:120 ERROR: prepared statement "stmtcache_4f7eb27a9c5de771fd67f023884673c0d00d03ce530b0de8" does not exist (SQLSTATE 26000) teldrive | [302.519ms] [rows:-] SELECT JSONB_AGG(uploads.part_id) as parts,uploads.channel_id,uploads.user_id,s.session FROM "teldrive"."uploads" left join teldrive.users as u on u.user_id = uploads.user_id left join (select * from teldrive.sessions order by created_at desc limit 1) as s on s.user_id = uploads.user_id WHERE uploads.created_at < '2024-07-10 22:05:52.915' GROUP BY "uploads"."channel_id","uploads"."user_id","s"."session" ```
iwconfig commented 2 months ago

Found {a,the} solution:

image

Thank you!