From c814cc62faf46c0d05f001c167328324439dfa1a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Fri, 25 Sep 2020 14:59:07 +0300 Subject: [PATCH] [#158] pkg/client: Ignore EOF on buffer copy in object.Put There is a issue when user sends payload chunk to the neofs node, but node closes connection earlier, e.g. node can return error as soon as it checked ACL permission and denied request. In this case client will receive EOF error and it produces `could not send payload bytes to Put object stream` error, but in fact there is different error. If we ignore EOF there then `stream.CloseAndRecv()` return correct error message later. Signed-off-by: Alex Vanin --- pkg/client/object.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/client/object.go b/pkg/client/object.go index 04724d1..b8fe520 100644 --- a/pkg/client/object.go +++ b/pkg/client/object.go @@ -232,7 +232,8 @@ func (c *Client) putObjectV2(ctx context.Context, p *PutObjectParams, opts ...Ca } // copy payload from reader to stream writer - if _, err := io.CopyBuffer(w, rPayload, make([]byte, chunkSize)); err != nil { + _, err = io.CopyBuffer(w, rPayload, make([]byte, chunkSize)) + if err != nil && !errors.Is(errors.Cause(err), io.EOF) { return nil, errors.Wrap(err, "could not send payload bytes to Put object stream") }