Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Fix TUS chunked upload and resume failures (#8783) (#8786)

Chris Lu3a3fff1399d5
diff --git a/.github/workflows/tus-tests.yml b/.github/workflows/tus-tests.yml
index 62b393311b..2acfa6e1d9 100644
--- a/.github/workflows/tus-tests.yml
+++ b/.github/workflows/tus-tests.yml
@@ -2,17 +2,6 @@ name: "TUS Protocol Tests"
on:
pull_request:
- paths:
- - 'weed/server/filer_server_tus*.go'
- - 'weed/server/filer_server.go'
- - 'test/tus/**'
- - '.github/workflows/tus-tests.yml'
- push:
- branches: [ master, main ]
- paths:
- - 'weed/server/filer_server_tus*.go'
- - 'weed/server/filer_server.go'
- - 'test/tus/**'
concurrency:
group: ${{ github.head_ref || github.ref }}/tus-tests
diff --git a/weed/server/filer_server_tus_handlers.go b/weed/server/filer_server_tus_handlers.go
index 8e31e32d48..7650401827 100644
--- a/weed/server/filer_server_tus_handlers.go
+++ b/weed/server/filer_server_tus_handlers.go
@@ -80,7 +80,10 @@ func (fs *FilerServer) tusOptionsHandler(w http.ResponseWriter, r *http.Request)
// tusCreateHandler handles POST requests to create new uploads
func (fs *FilerServer) tusCreateHandler(w http.ResponseWriter, r *http.Request) {
- ctx := r.Context()
+ // Use a context that ignores cancellation from the request context.
+ // Internal operations (creating TUS session, writing data, completing uploads)
+ // may exceed the filer's client connection inactivity timeout.
+ ctx := context.WithoutCancel(r.Context())
// Parse Upload-Length header (required)
uploadLengthStr := r.Header.Get("Upload-Length")
@@ -195,7 +198,11 @@ func (fs *FilerServer) tusHeadHandler(w http.ResponseWriter, r *http.Request, up
// tusPatchHandler handles PATCH requests to upload data
func (fs *FilerServer) tusPatchHandler(w http.ResponseWriter, r *http.Request, uploadID string) {
- ctx := r.Context()
+ // Use a context that ignores cancellation from the request context.
+ // The filer's connection has an inactivity timeout: after the request body is fully read,
+ // internal operations (assigning file IDs, uploading to volume servers, completing uploads)
+ // may exceed the timeout, causing the request context to be canceled.
+ ctx := context.WithoutCancel(r.Context())
// Validate Content-Type
contentType := r.Header.Get("Content-Type")