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.

chore(upload): log offset/bytes-read context on chunk ReadFrom errors (#9169)

Chris Lu0a5c22b57e17
diff --git a/weed/operation/upload_chunked.go b/weed/operation/upload_chunked.go
index 57109b149f..cfcb07634c 100644
--- a/weed/operation/upload_chunked.go
+++ b/weed/operation/upload_chunked.go
@@ -99,12 +99,16 @@ uploadLoop:
// Read one chunk
dataSize, err := bytesBuffer.ReadFrom(limitedReader)
if err != nil {
- glog.V(2).Infof("UploadReaderInChunks: read error at offset %d: %v", chunkOffset, err)
+ // Attach offset + bytes-read to distinguish client disconnect
+ // before any data (offset=0,got=0) from mid-stream truncation.
+ // A bare io.ErrUnexpectedEOF is not actionable on its own (see #9149).
+ wrapped := fmt.Errorf("read chunk at offset %d (got %d bytes): %w", chunkOffset, dataSize, err)
+ glog.V(2).Infof("UploadReaderInChunks: %v", wrapped)
chunkBufferPool.Put(bytesBuffer)
<-bytesBufferLimitChan
uploadErrLock.Lock()
if uploadErr == nil {
- uploadErr = err
+ uploadErr = wrapped
}
uploadErrLock.Unlock()
break