-
Notifications
You must be signed in to change notification settings - Fork 224
Open
Description
The ExampleStreamDirector (in examples_test.go) my run:
return nil, nil, grpc.Errorf(codes.Unimplemented, "Unknown method")
handler.go then uses the outgoingCtx without first checking for an error:
outgoingCtx, backendConn, err := s.director(serverStream.Context(), fullMethodName)
clientCtx, clientCancel := context.WithCancel(outgoingCtx)
if err != nil {
return err
}
This leads to a nil pointer dereference if the directory really returns an error:
context.propagateCancel(0x0, 0x0, 0xa0ab80, 0xc4203be0c0)
/usr/lib/go-1.10/src/context/context.go:243 +0x26
context.WithCancel(0x0, 0x0, 0xda1f90, 0x982680, 0xc4203ac3c0)
/usr/lib/go-1.10/src/context/context.go:232 +0x111
github.com/intel/open-infrastructure-offload/vendor/golang.org/x/net/context.WithCancel(0x0, 0x0, 0xc420384040, 0x1c, 0x0)
/fast/work/gopath/src/github.com/intel/open-infrastructure-offload/vendor/golang.org/x/net/context/go17.go:33 +0x35
github.com/intel/open-infrastructure-offload/vendor/github.com/mwitkow/grpc-proxy/proxy.(*handler).handler(0xc4202b8010, 0x0, 0x0, 0xa111c0, 0xc4203d40a0, 0x0, 0x0)
/fast/work/gopath/src/github.com/intel/open-infrastructure-offload/vendor/github.com/mwitkow/grpc-proxy/proxy/handler.go:70 +0x11e
github.com/intel/open-infrastructure-offload/vendor/github.com/mwitkow/grpc-proxy/proxy.(*handler).(github.com/intel/open-infrastructure-offload/vendor/github.com/mwitkow/grpc-proxy/proxy.handler)-fm(0x0, 0x0, 0xa111c0, 0xc4203d40a0, 0x0, 0x0)
/fast/work/gopath/src/github.com/intel/open-infrastructure-offload/vendor/github.com/mwitkow/grpc-proxy/proxy/handler.go:35 +0x52
github.com/intel/open-infrastructure-offload/vendor/google.golang.org/grpc.(*Server).processStreamingRPC(0xc4202e8000, 0xa11760, 0xc4202a6600, 0xc4203ac3c0, 0x0, 0xc4202e00e0, 0x0, 0x0, 0x0)
/fast/work/gopath/src/github.com/intel/open-infrastructure-offload/vendor/google.golang.org/grpc/server.go:1052 +0x9b4
I suppose the err check should come before context.WithCancel(outgoingCtx)?
Metadata
Metadata
Assignees
Labels
No labels