gogs / gogs

Gogs is a painless self-hosted Git service
https://gogs.io
MIT License
44.86k stars 4.85k forks source link

Failed on uploading a large (1GB+) file in Releases #6149

Open cci-help opened 4 years ago

cci-help commented 4 years ago

Describe the bug When uploading a large file in Releases (after raising the default limit), the upload times out with the error message:

[ERROR] [reflect/value.go:460 call()] parse multipart form: multipart: NextPart: stream error: stream ID 39; CANCEL

or, in a similar vein:

[reflect/value.go:460 call()] parse multipart form: multipart: NextPart: stream error: stream ID 81; CANCEL

Gogs version and commit Build time: 2020-05-04 10:53:31 UTC Build commit: 9fd4f5562d7a59abbef5e78d44fb85a0041e0733

Git version

2.24.3

Operating system Ubuntu 16.04 LTS (docker gogs/gogs:latest)

Database postgres 9.5 (docker)

To Reproduce Steps to reproduce the behavior:

  1. Raise release file size limit.
  2. Upload at least a 1.5GB+ file as a Release in a repo.
  3. Wait for it to timeout.

Can you reproduce the bug at https://try.gogs.io? No, cannot upload file that large.

Expected behavior I expect Gogs to complete the file upload and not time out.

Actual behavior Gogs will time out, produce the error code above, and not allow the download to continue.

Screenshots image

Additional context

2020/05/06 13:23:42 [ INFO] Run mode: Production
2020/05/06 13:23:43 [ INFO] Listen on https://0.0.0.0:3000
2020/05/06 13:24:29 [ERROR] [reflect/value.go:460 call()] parse multipart form: multipart: NextPart: stream error: stream ID 39; CANCEL
2020/05/06 13:28:01 [ERROR] [reflect/value.go:460 call()] parse multipart form: multipart: NextPart: stream error: stream ID 81; CANCEL

I've tried both Chrome and Firefox. Uploading from Windows Server 2016.

unknwon commented 4 years ago

Code handles release upload is here: https://github.com/gogs/gogs/blob/9fd4f5562d7a59abbef5e78d44fb85a0041e0733/internal/cmd/web.go#L326

wbollock commented 4 years ago

Further testing has it stop at around 1.3GB or so. But it's variable, seems like a client timeout if a certain amount of time is spent uploading? I'm not well versed in Go.

qshiroe commented 2 weeks ago

in the public/js/gogs.js file, it is required to explicitly specify no timeout

$dropzone.dropzone({ url: $dropzone.data("upload-url"), headers: { "X-CSRF-Token": csrf }, maxFiles: $dropzone.data("max-file"), maxFilesize: $dropzone.data("max-size"), timeout: 0, ...