Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry when getting an EOF on HEAD/GET requests because of a Golang bug #41

Merged
merged 1 commit into from
May 21, 2015

Conversation

lebauce
Copy link
Collaborator

@lebauce lebauce commented May 19, 2015

When running a 30 minutes testsuite (https://github.com/lebauce/distribution), I faced a weird issue : I sometimes got a url.Error : "Head https://my.swift.server/v1/AUTH_abcdb3abcda34a1c8d618164d99eb53e/test/myobject : EOF". I'm using the 1.4.2 version of Go.

The issue seems to be in the net/http library and is described in both tickets :
golang/go#4677
golang/go#8946

A fix on net/http is under review : https://golang.org/cl/3210

A fix for this problem is simply to send the request again when the request was a HEAD or a GET

@ncw
Copy link
Owner

ncw commented May 19, 2015

That fix looks safe to me.

What do you think about retrying on any error on a HEAD or GET? These requests are idempotent in the swift API so there should be no problems with that.

@vtolstov
Copy link

this can helps me with my issue when i'm upload file and can't get it back

@ncw
Copy link
Owner

ncw commented May 19, 2015

@vtolstov probably not since we are just talking about HEAD/GET requests not PUT/POST which would be used to upload data.

@vtolstov
Copy link

@ncw i'm also have issues in head requests, but file present and after 1,3,5 -10 seconds displayed

@ncw
Copy link
Owner

ncw commented May 19, 2015

@vtolstov that sounds like it could be swift's eventual consistency in action? Is your swift server very busy?

@vtolstov
Copy link

@ncw yes, sometimes my swift servers very busy (backends have massive loading by container replicator)

@lebauce
Copy link
Collaborator Author

lebauce commented May 21, 2015

@ncw Something like :

        resp, err = c.doTimeoutRequest(timer, req)
        if err != nil {
            if urlError, ok := err.(*url.Error); ok {
                if p.Operation == "HEAD" || p.Operation == "GET" {
                    retries--;
                    continue
                }
            }
            return
        }

?

@ncw
Copy link
Owner

ncw commented May 21, 2015

@lebauce Or maybe even this?

        resp, err = c.doTimeoutRequest(timer, req)
        if err != nil {
                if p.Operation == "HEAD" || p.Operation == "GET" {
                    retries--;
                    continue
                }
                return
        }

@lebauce
Copy link
Collaborator Author

lebauce commented May 21, 2015

@ncw Indeed, it's better. I updated the PR

@ncw ncw merged commit e3dfa3c into ncw:master May 21, 2015
@ncw
Copy link
Owner

ncw commented May 21, 2015

Thank you very much for that.

-- Nick

@lebauce lebauce deleted the retry-on-eof branch May 22, 2015 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants