tus / tusd

Reference server implementation in Go of tus: the open protocol for resumable file uploads
https://tus.github.io/tusd
MIT License
2.92k stars 465 forks source link

gcsstore: Fix error creating new uploads #1131

Closed emilaleksanteri closed 1 month ago

emilaleksanteri commented 1 month ago

Change r.Read(buf) to io.ReadFull(buf) as discussed in issue #1124 to fix EOF error on .info read from GCS

Acconut commented 1 month ago

The tests are failing now because they are running out of memory: https://github.com/tus/tusd/actions/runs/8983182072/job/24727119301?pr=1131

The test has probably be adjusted, so that io.ReadAll can terminate.

emilaleksanteri commented 1 month ago

The tests are failing now because they are running out of memory: https://github.com/tus/tusd/actions/runs/8983182072/job/24727119301?pr=1131

The test has probably be adjusted, so that io.ReadAll can terminate.

On it, can I run the tests for the gcsstore with just go test or is there some other stuff I should know for local dev on the repo?

Acconut commented 1 month ago

Thanks, running go test ./pkg/gcsstore is sufficient.

emilaleksanteri commented 1 month ago

@Acconut switched io.ReadAll to io.ReadFull from a buffer size of the ReadObject reader, this seemed to also solve the EOF issue and solved all the issues with the tests.

Acconut commented 1 month ago

Thanks for your update, but I still prefer using io.ReadAll instead of relying on Size() to give us a correct file size. I added a commit, switching to io.ReadAll, but also adjusting the tests, which had a custom implementation of GCSReader, which never returned an EOF, causing io.ReadAll to run out of memory.