Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

vendor: update github.com/ncw/swift to fix memory leak in swift transfers

Nick Craig-Wood567071750bca
diff --git a/Gopkg.lock b/Gopkg.lock
index cc4724f02..d2c34f607 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -136,7 +136,7 @@
branch = "master"
name = "github.com/ncw/swift"
packages = ["."]
- revision = "9d3f812e23d270d1c66a9a01e20af1005061cdc4"
+ revision = "c95c6e5c2d1a3d37fc44c8c6dc9e231c7500667d"
[[projects]]
branch = "master"
@@ -157,10 +157,10 @@
revision = "2b3a18b5f0fb6b4f9190549597d3f962c02bc5eb"
[[projects]]
+ branch = "master"
name = "github.com/pkg/sftp"
packages = ["."]
- revision = "98203f5a8333288eb3163b7c667d4260fe1333e9"
- version = "1.0.0"
+ revision = "7c1f7a370726a2457b33b29baefc2402b4965c65"
[[projects]]
name = "github.com/pmezard/go-difflib"
diff --git a/vendor/github.com/ncw/swift/largeobjects.go b/vendor/github.com/ncw/swift/largeobjects.go
index 48594a723..bec640b00 100644
--- a/vendor/github.com/ncw/swift/largeobjects.go
+++ b/vendor/github.com/ncw/swift/largeobjects.go
@@ -276,8 +276,9 @@ func (file *largeObjectCreateFile) Size() int64 {
}
func withLORetry(expectedSize int64, fn func() (Headers, int64, error)) (err error) {
+ endTimer := time.NewTimer(readAfterWriteTimeout)
+ defer endTimer.Stop()
waitingTime := readAfterWriteWait
- endTimer := time.After(readAfterWriteTimeout)
for {
var headers Headers
var sz int64
@@ -288,11 +289,13 @@ func withLORetry(expectedSize int64, fn func() (Headers, int64, error)) (err err
} else {
return
}
+ waitTimer := time.NewTimer(waitingTime)
select {
- case <-endTimer:
+ case <-endTimer.C:
+ waitTimer.Stop()
err = fmt.Errorf("Timeout expired while waiting for object to have size == %d, got: %d", expectedSize, sz)
return
- case <-time.After(waitingTime):
+ case <-waitTimer.C:
waitingTime *= 2
}
}
diff --git a/vendor/github.com/ncw/swift/swift.go b/vendor/github.com/ncw/swift/swift.go
index 1e8589c7b..38e696532 100644
--- a/vendor/github.com/ncw/swift/swift.go
+++ b/vendor/github.com/ncw/swift/swift.go
@@ -471,6 +471,7 @@ again:
}
if req != nil {
timer := time.NewTimer(c.ConnectTimeout)
+ defer timer.Stop()
var resp *http.Response
resp, err = c.doTimeoutRequest(timer, req)
if err != nil {
@@ -691,6 +692,7 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,
URL.RawQuery = p.Parameters.Encode()
}
timer := time.NewTimer(c.ConnectTimeout)
+ defer timer.Stop()
reader := p.Body
if reader != nil {
reader = newWatchdogReader(reader, c.Timeout, timer)
diff --git a/vendor/github.com/ncw/swift/timeout_reader.go b/vendor/github.com/ncw/swift/timeout_reader.go
index 3839e9ea0..88ae73328 100644
--- a/vendor/github.com/ncw/swift/timeout_reader.go
+++ b/vendor/github.com/ncw/swift/timeout_reader.go
@@ -38,10 +38,12 @@ func (t *timeoutReader) Read(p []byte) (int, error) {
done <- result{n, err}
}()
// Wait for the read or the timeout
+ timer := time.NewTimer(t.timeout)
+ defer timer.Stop()
select {
case r := <-done:
return r.n, r.err
- case <-time.After(t.timeout):
+ case <-timer.C:
t.cancel()
return 0, TimeoutError
}
diff --git a/vendor/github.com/pkg/sftp/sftp.go b/vendor/github.com/pkg/sftp/sftp.go
index 22184afe0..3cdb14df8 100644
--- a/vendor/github.com/pkg/sftp/sftp.go
+++ b/vendor/github.com/pkg/sftp/sftp.go
@@ -1,5 +1,5 @@
// Package sftp implements the SSH File Transfer Protocol as described in
-// https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
+// https://tools.ietf.org/html/draft-ietf-secsh-filexfer-02
package sftp
import (