X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3a3d67ccee068a85aa3b79c5abd40170223071e3..e3f324c979fe45803e2bd42aa8f6d715ea23edb5:/services/keepstore/handlers.go diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go index 7da9f69adb..9a4d02df85 100644 --- a/services/keepstore/handlers.go +++ b/services/keepstore/handlers.go @@ -277,13 +277,19 @@ func (rtr *router) IndexHandler(resp http.ResponseWriter, req *http.Request) { for _, v := range vols { if err := v.IndexTo(prefix, resp); err != nil { - // The only errors returned by IndexTo are - // write errors returned by resp.Write(), - // which probably means the client has - // disconnected and this error will never be - // reported to the client -- but it will - // appear in our own error log. - http.Error(resp, err.Error(), http.StatusInternalServerError) + // We can't send an error message to the + // client because we might have already sent + // headers and index content. All we can do is + // log the error in our own logs, and (in + // cases where headers haven't been sent yet) + // set a 500 status. + // + // If headers have already been sent, the + // client must notice the lack of trailing + // newline as an indication that the response + // is incomplete. + log.Printf("index error from volume %s: %s", v, err) + http.Error(resp, "", http.StatusInternalServerError) return } } @@ -675,6 +681,11 @@ func GetBlock(ctx context.Context, hash string, buf []byte, resp http.ResponseWr if !os.IsNotExist(err) { log.Printf("%s: Get(%s): %s", vol, hash, err) } + // If some volume returns a transient error, return it to the caller + // instead of "Not found" so it can retry. + if err == VolumeBusyError { + errorToCaller = err.(*KeepError) + } continue } // Check the file checksum.