diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 5f61882c3..ff3d53925 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -1296,8 +1296,8 @@ func readBytes(buf []byte, bc *handshake.BufferedConn, maxDataSize int) ([]byte, if dataSize == 0 { return buf, nil } - if _, err := io.ReadFull(bc, buf); err != nil { - return buf, fmt.Errorf("cannot read data with size %d: %s", dataSize, err) + if n, err := io.ReadFull(bc, buf); err != nil { + return buf, fmt.Errorf("cannot read data with size %d: %s; read only %d bytes", dataSize, err, n) } return buf, nil } diff --git a/app/vmstorage/transport/server.go b/app/vmstorage/transport/server.go index 2fcdcdea7..b09e07d0c 100644 --- a/app/vmstorage/transport/server.go +++ b/app/vmstorage/transport/server.go @@ -291,8 +291,8 @@ func (s *Server) processVMInsertConn(r io.Reader) error { return fmt.Errorf("too big packet size: %d; shouldn't exceed %d", packetSize, consts.MaxInsertPacketSize) } buf = bytesutil.Resize(buf, int(packetSize)) - if _, err := io.ReadFull(r, buf); err != nil { - return fmt.Errorf("cannot read packet with size %d: %s", packetSize, err) + if n, err := io.ReadFull(r, buf); err != nil { + return fmt.Errorf("cannot read packet with size %d: %s; read only %d bytes", packetSize, err, n) } vminsertPacketsRead.Inc() @@ -386,8 +386,8 @@ func (ctx *vmselectRequestCtx) readDataBufBytes(maxDataSize int) error { if dataSize == 0 { return nil } - if _, err := io.ReadFull(ctx.bc, ctx.dataBuf); err != nil { - return fmt.Errorf("cannot read data with size %d: %s", dataSize, err) + if n, err := io.ReadFull(ctx.bc, ctx.dataBuf); err != nil { + return fmt.Errorf("cannot read data with size %d: %s; read only %d bytes", dataSize, err, n) } return nil } diff --git a/lib/handshake/handshake.go b/lib/handshake/handshake.go index 0a71bdd1a..814611985 100644 --- a/lib/handshake/handshake.go +++ b/lib/handshake/handshake.go @@ -158,8 +158,8 @@ func readData(c net.Conn, dataLen int) ([]byte, error) { return nil, fmt.Errorf("cannot set read deadline: %s", err) } data := make([]byte, dataLen) - if _, err := io.ReadFull(c, data); err != nil { - return nil, fmt.Errorf("cannot read message with size %d: %s", dataLen, err) + if n, err := io.ReadFull(c, data); err != nil { + return nil, fmt.Errorf("cannot read message with size %d: %s; read only %d bytes", dataLen, err, n) } if err := c.SetReadDeadline(zeroTime); err != nil { return nil, fmt.Errorf("cannot reset read deadline: %s", err)