Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil pointer dereference panic when accessing a streaming server that is not implemented #394

Closed
fernferret opened this issue May 12, 2023 · 0 comments · Fixed by #395
Closed

Comments

@fernferret
Copy link

fernferret commented May 12, 2023

I believe the invokeServerStream function does not properly check the err on line 265.

This (can) cause a nil panic if the method is not implemented (or another error occurs) on line 267's str.Header().


Update: Interestingly I'm only seeing this behavior when using github.com/fullstorydev/grpchan. I'm still investigating but I think before a PR is opened the question needs to be asked as to which the proper behavior is. That is to say: How should a Streaming service note that it's not implemented?

This isn't a huge deal as I immediately plan on implementing this service but it was a fun rabbit hole to go down so far, so I'll keep investigating before opening a PR.


I believe this is as simple as following the pattern used in the invokeUnary function above and am preparing a PR.

Here is an example (trimmed) trace:

invalid memory address or nil pointer dereference goroutine 5 [running]:
panic({0x171fb20, 0x1e92260})
	/usr/local/Cellar/go/1.20.2/libexec/src/runtime/panic.go:884 +0x213
github.com/jhump/protoreflect/dynamic/grpcdynamic.(*ServerStream).Header(...)
	/Users/fernferret/projects/wab/vendor/github.com/jhump/protoreflect/dynamic/grpcdynamic/stub.go:178
github.com/fullstorydev/grpcurl.invokeServerStream({0x1912408, ...
	/Users/fernferret/projects/wab/vendor/github.com/fullstorydev/grpcurl/invoke.go:267 +0x217
github.com/fullstorydev/grpcurl.InvokeRPC({0x1912408, ...
	/Users/fernferret/projects/wab/vendor/github.com/fullstorydev/grpcurl/invoke.go:147 +0x78a
github.com/fullstorydev/grpcui.invokeRPC({0x1912408, ...
	/Users/fernferret/projects/wab/vendor/github.com/fullstorydev/grpcui/handlers.go:464 +0x69c
github.com/fullstorydev/grpcui.RPCInvokeHandlerWithOptions.func1({0x1910cf0, ...
	/Users/fernferret/projects/wab/vendor/github.com/fullstorydev/grpcui/handlers.go:98 +0x3c7
net/http.HandlerFunc.ServeHTTP(0x171abe0?, ...
	/usr/local/Cellar/go/1.20.2/libexec/src/net/http/server.go:2122 +0x2f

Thanks so much for this great library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant