aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2022-09-01 22:31:57 +0500
committerGitHub <noreply@github.com>2022-09-01 10:31:57 -0700
commit90d55cd179732a375f112c72893e2cca1b41afd1 (patch)
tree1aff3e60df737571dbbfa154928eb56bc46039fa
parent86a5b6183de6e94d2f7fde4123cd8677bd4bfff3 (diff)
downloadseaweedfs-90d55cd179732a375f112c72893e2cca1b41afd1.tar.xz
seaweedfs-90d55cd179732a375f112c72893e2cca1b41afd1.zip
avoid data race read fileChunksSize (#3570)
https://github.com/seaweedfs/seaweedfs/issues/3557
-rw-r--r--weed/server/filer_server_handlers_write_upload.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/weed/server/filer_server_handlers_write_upload.go b/weed/server/filer_server_handlers_write_upload.go
index 1a7449670..4dc588055 100644
--- a/weed/server/filer_server_handlers_write_upload.go
+++ b/weed/server/filer_server_handlers_write_upload.go
@@ -118,8 +118,9 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
if chunk != nil {
fileChunksLock.Lock()
fileChunks = append(fileChunks, chunk)
+ fileChunksSize := len(fileChunks)
fileChunksLock.Unlock()
- glog.V(4).Infof("uploaded %s chunk %d to %s [%d,%d)", fileName, len(fileChunks), chunk.FileId, offset, offset+int64(chunk.Size))
+ glog.V(4).Infof("uploaded %s chunk %d to %s [%d,%d)", fileName, fileChunksSize, chunk.FileId, offset, offset+int64(chunk.Size))
}
}(chunkOffset)