diced / zipline

A ShareX/file upload server that is easy to use, packed with features, and with an easy setup!

Home Page:https://zipline.diced.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Upload file with size larger than 2 GB crashes the app after chunk processing was finished

lemonderon opened this issue · comments

What happened?

Whenever I try to upload file of size larger than 2147483647 bytes (SQL 4-byte integer limit) the container crashes with error tied to file size written to Postgres. The crash occurs immediately after successful processing of uploaded chunks.
The uploaded file is present on the system and can be later accessed on container restart.

Version

latest (ghcr.io/diced/zipline or ghcr.io/diced/zipline:latest)

What browser(s) are you seeing the problem on?

Chromium-based (Chrome, Edge, Brave, Opera, mobile chrome/chromium based, etc)

Zipline Logs

node:internal/event_target:1012
  process.nextTick(() => { throw err; });
                           ^
Error: 
Invalid `prisma.file.update()` invocation:
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: ToSql(4), cause: Some(Error { kind: ConversionError("Unable to fit integer value '3221225472' into an INT4 (32-bit signed integer)."), original_code: None, original_message: None }) }), transient: false })
    at Rs.handleRequestError (/zipline/node_modules/@prisma/client/src/runtime/RequestHandler.ts:220:13)
    at Rs.handleAndLogRequestError (/zipline/node_modules/@prisma/client/src/runtime/RequestHandler.ts:173:12)
    at Rs.request (/zipline/node_modules/@prisma/client/src/runtime/RequestHandler.ts:163:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at t._request (/zipline/node_modules/@prisma/client/src/runtime/getPrismaClient.ts:1036:14)
    at runFileComplete (/zipline/src/worker/upload.ts:138:9)
    at start (/zipline/src/worker/upload.ts:105:5)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:300:10)
    at [kOnMessage] (node:internal/worker:311:37)
    at MessagePort.<anonymous> (node:internal/worker:212:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:737:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

Node.js v18.16.0

Browser Logs

No response

Additional Info

This bug occurs on both postgres:14 and postgres:15 (official docker images).

I had a similar issue to you and I tried to add the data manually to the database instead. I found that the data type used for the file size is INT (which has a 4-byte integer limit). After changing the integer type to BIGINT (limit is 2^63 -1), i was able to get the file to show up.

If you need to fix this before a patch is made, access the postgre database with psql in your docker instance and run ALTER TABLE "File" ALTER COLUMN size TYPE BIGINT;