From 708b967f1555e187b1d68a89acd9a10fd5c4add5 Mon Sep 17 00:00:00 2001 From: Aleksandar Jankovic Date: Tue, 18 Feb 2020 18:05:58 +0100 Subject: [PATCH] backend/s3: fix multipart abort context S3 couldn't abort multi-part upload when context is canceled because canceled context prevents abort request from being sent. --- backend/s3/s3.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index fe53d1479..d905fc678 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -1799,8 +1799,9 @@ func (f *Fs) copyMultipart(ctx context.Context, req *s3.CopyObjectInput, dstBuck defer func() { if err != nil { // We can try to abort the upload, but ignore the error. + fs.Debugf(nil, "Cancelling multipart copy") _ = f.pacer.Call(func() (bool, error) { - _, err := f.c.AbortMultipartUploadWithContext(ctx, &s3.AbortMultipartUploadInput{ + _, err := f.c.AbortMultipartUploadWithContext(context.Background(), &s3.AbortMultipartUploadInput{ Bucket: &dstBucket, Key: &dstPath, UploadId: uid, @@ -2172,7 +2173,7 @@ func (o *Object) uploadMultipart(ctx context.Context, req *s3.PutObjectInput, si // We can try to abort the upload, but ignore the error. fs.Debugf(o, "Cancelling multipart upload") errCancel := f.pacer.Call(func() (bool, error) { - _, err := f.c.AbortMultipartUploadWithContext(ctx, &s3.AbortMultipartUploadInput{ + _, err := f.c.AbortMultipartUploadWithContext(context.Background(), &s3.AbortMultipartUploadInput{ Bucket: req.Bucket, Key: req.Key, UploadId: uid,