Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request moby#2385 from venturehacks/panic_failed_to_get_edge
Browse files Browse the repository at this point in the history
don't cast Value when pipe is errored
  • Loading branch information
tonistiigi committed Oct 2, 2021
2 parents 42aefeb + e76cfcf commit d429b0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion solver/edge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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):]
Expand Down
2 changes: 1 addition & 1 deletion solver/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit d429b0b

Please sign in to comment.