mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-30 19:55:48 +00:00
chore(upload): log offset/bytes-read context on chunk ReadFrom errors (#9169)
chore(upload): add offset/bytes-read context to chunk ReadFrom errors Wrap io.ErrUnexpectedEOF (and siblings) from bytesBuffer.ReadFrom so the log shows "read chunk at offset N (got M bytes): ..." instead of a bare "unexpected EOF". The context distinguishes a client disconnect before any data arrived (offset=0, got=0) from a mid-stream truncation (offset>0, got<chunkSize) — diagnosing #9149 in the wild. Verified at this stage that expectedDataSize is already threaded correctly from upload_chunked.go (actual ReadFrom bytes) through s3api assignFunc → filer AssignVolume → master PickForWrite. No behavioral change to what the master receives.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user