From bb1198c2c6068f5d82fa133976566c8c5845652c Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 23 Apr 2021 10:18:18 -0700 Subject: [PATCH] revert CreateFile waitForResponse (#12124) instead use expect continue timeout, and have higher response header timeout, the new higher timeout satisfies worse case scenarios for total response time on a CreateFile operation. Also set the "expect" continue header to satisfy expect continue timeout behavior. Some clients seem to cause CreateFile body to be truncated, leading to no errors which instead fails with ObjectNotFound on a PUT operation, this change avoids such failures appropriately. Signed-off-by: Harshavardhana --- cmd/rest/client.go | 1 + cmd/storage-rest-client.go | 4 ---- cmd/utils.go | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/rest/client.go b/cmd/rest/client.go index ccac83ce8..99ddf432e 100644 --- a/cmd/rest/client.go +++ b/cmd/rest/client.go @@ -127,6 +127,7 @@ func (c *Client) Call(ctx context.Context, method string, values url.Values, bod } req.Header.Set("Authorization", "Bearer "+c.newAuthToken(req.URL.RawQuery)) req.Header.Set("X-Minio-Time", time.Now().UTC().Format(time.RFC3339)) + req.Header.Set("Expect", "100-continue") if length > 0 { req.ContentLength = length } diff --git a/cmd/storage-rest-client.go b/cmd/storage-rest-client.go index b61fb97e2..e650d41ce 100644 --- a/cmd/storage-rest-client.go +++ b/cmd/storage-rest-client.go @@ -337,10 +337,6 @@ func (client *storageRESTClient) CreateFile(ctx context.Context, volume, path st values.Set(storageRESTFilePath, path) values.Set(storageRESTLength, strconv.Itoa(int(size))) respBody, err := client.call(ctx, storageRESTMethodCreateFile, values, ioutil.NopCloser(reader), size) - if err != nil { - return err - } - _, err = waitForHTTPResponse(respBody) defer http.DrainBody(respBody) return err } diff --git a/cmd/utils.go b/cmd/utils.go index 83811134f..deedc1fdd 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -456,7 +456,7 @@ func newInternodeHTTPTransport(tlsConfig *tls.Config, dialTimeout time.Duration) WriteBufferSize: 32 << 10, // 32KiB moving up from 4KiB default ReadBufferSize: 32 << 10, // 32KiB moving up from 4KiB default IdleConnTimeout: 15 * time.Second, - ResponseHeaderTimeout: 3 * time.Minute, // Set conservative timeouts for MinIO internode. + ResponseHeaderTimeout: 15 * time.Minute, // Set conservative timeouts for MinIO internode. TLSHandshakeTimeout: 15 * time.Second, ExpectContinueTimeout: 15 * time.Second, TLSClientConfig: tlsConfig,