From e76cfcfa220b1108097072208829ec330782547d Mon Sep 17 00:00:00 2001 From: Maxime Lagresle Date: Fri, 1 Oct 2021 23:34:39 +0200 Subject: [PATCH] don't cast Value when pipe is errored Signed-off-by: Maxime Lagresle --- solver/edge.go | 9 ++++++++- solver/scheduler.go | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/solver/edge.go b/solver/edge.go index 2ab010f95a84..b6d65b5b6b0c 100644 --- a/solver/edge.go +++ b/solver/edge.go @@ -458,7 +458,14 @@ func (e *edge) processUpdate(upt pipe.Receiver) (depChanged bool) { dep.err = err } - state := upt.Status().Value.(*edgeState) + if upt.Status().Value == nil { + return + } + state, isEdgeState := upt.Status().Value.(*edgeState) + if !isEdgeState { + bklog.G(context.TODO()).Warnf("invalid edgeState value for update: %T", state) + return + } if len(dep.keys) < len(state.keys) { newKeys := state.keys[len(dep.keys):] diff --git a/solver/scheduler.go b/solver/scheduler.go index d56b06c9f3eb..02d14c7fa0ca 100644 --- a/solver/scheduler.go +++ b/solver/scheduler.go @@ -352,7 +352,7 @@ func (pf *pipeFactory) NewInputRequest(ee Edge, req *edgeRequest) pipe.Receiver target := pf.s.ef.getEdge(ee) if target == nil { return pf.NewFuncRequest(func(_ context.Context) (interface{}, error) { - return req, errors.Errorf("failed to get edge: inconsistent graph state") + return nil, errors.Errorf("failed to get edge: inconsistent graph state") }) } p := pf.s.newPipe(target, pf.e, pipe.Request{Payload: req})