Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ste/xferRetryHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ package ste
import (
"errors"
"fmt"
"github.com/Azure/azure-storage-azcopy/v10/common"
"io"
"net"
"net/http"
"strconv"
"strings"
"syscall"

"github.com/Azure/azure-storage-azcopy/v10/common"
)

// Defines the retry policy rules
Expand Down Expand Up @@ -98,6 +101,13 @@ func GetShouldRetry(log *LogOptions) RetryFunc {
}
}

// Check for some OS-agnostic errors that could be retried
if errors.Is(err, net.ErrClosed) ||
errors.Is(err, io.ErrUnexpectedEOF) ||
errors.Is(err, io.EOF) { // Notably, we shouldn't really be getting back EOF...
return true
}

// Check if we're in a retriable error defined by the OS specific file
if len(platformRetriedErrnos) > 0 &&
IsOSErrors(err, platformRetriedErrnos...) {
Expand Down
15 changes: 13 additions & 2 deletions ste/xferRetryHelper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package ste

import (
"errors"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
"github.com/stretchr/testify/assert"
"io"
"net"
"net/http"
"runtime"
"syscall"
"testing"

"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/bloberror"
"github.com/stretchr/testify/assert"
)

func TestGetShouldRetry(t *testing.T) {
Expand Down Expand Up @@ -86,6 +89,14 @@ func TestGetShouldRetry(t *testing.T) {
Rules: ParseRules("409: ShareAlreadyExists, ShareBeingDeleted, BlobAlreadyExists; 500; 404: BlobNotFound"),
Tests: syscallErrnoTests(platformRetriedErrnos, true),
},
{
Rules: ParseRules("409: ShareAlreadyExists, ShareBeingDeleted, BlobAlreadyExists; 500; 404: BlobNotFound"),
Tests: []*ResponseRetryPair{
ErrorTest(io.ErrUnexpectedEOF, true),
ErrorTest(io.EOF, true),
ErrorTest(net.ErrClosed, true),
},
},
{ // test full code removal
Rules: ParseRules("400; 500; -400"),
Tests: []*ResponseRetryPair{
Expand Down
Loading