Skip to content

Commit

Permalink
EC: abort upon unexpected-eof
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Aizman <alex.aizman@gmail.com>
  • Loading branch information
alex-aizman committed Nov 24, 2024
1 parent c1299b8 commit d034d46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions ec/ec.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ const (
objSizeHighMem = 50 * cos.MiB
)

const invalOpcode = "invalid opcode"

type (
// request - structure to request an object to be EC'ed or restored
request struct {
Expand Down
11 changes: 7 additions & 4 deletions ec/getx.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ func (r *XactGet) dispatchResp(iReq intraReq, hdr *transport.ObjHdr, bck *meta.B
return
}
if err := _writerReceive(writer, iReq.exists, objAttrs, reader); err != nil {
err = fmt.Errorf("%s: failed to read %s replica: %w (uname %s)", core.T, bck.Cname(objName), err, uname)
r.AddErr(err, 0)
errN := fmt.Errorf("%s: failed to read %s replica: %w (uname %s)", core.T, bck.Cname(objName), err, uname)
r.AddErr(errN, 0)
if err == io.ErrUnexpectedEOF {
r.Abort(errN)
}
}
default:
debug.Assert(false, "invalid opcode ", hdr.Opcode)
nlog.Errorln(r.Name(), "invalid request opcode:", hdr.Opcode)
debug.Assert(false, invalOpcode, " ", hdr.Opcode)
nlog.Errorln(r.Name(), invalOpcode, hdr.Opcode)
}
}

Expand Down
4 changes: 2 additions & 2 deletions ec/respondx.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ func (r *XactRespond) dispatchReq(iReq intraReq, hdr *transport.ObjHdr, bck *met
r.AddErr(err, 0)
}
default:
debug.Assert(false, "invalid opcode ", hdr.Opcode)
nlog.Errorln(r.Name(), "invalid request opcode:", hdr.Opcode)
debug.Assert(false, invalOpcode, " ", hdr.Opcode)
nlog.Errorln(r.Name(), invalOpcode, hdr.Opcode)
}
}

Expand Down

0 comments on commit d034d46

Please sign in to comment.