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

panic: net/http: CloseNotify called after ServeHTTP finished #121

Closed
diogomonica opened this issue Mar 2, 2016 · 1 comment
Closed

panic: net/http: CloseNotify called after ServeHTTP finished #121

diogomonica opened this issue Mar 2, 2016 · 1 comment

Comments

@diogomonica
Copy link

I made a simple modification to the echo example in which I use a message that is type bytes:

message BytesMessage {
    bytes id =1;
}

Changed the proto for EchoBody to use BytesMessage:

    rpc EchoBody(BytesMessage) returns (BytesMessage) {
        option (google.api.http) = {
            post: "/v1/example/echo_body"
            body: "*"
        };
    }

Modified echo.go:EchoBody to be:

func (s *echoServer) EchoBody(ctx context.Context, msg *examples.BytesMessage) (*examples.BytesMessage, error) {

And then when I send invalid information:

➜   curl -X POST -k http://localhost:8080/v1/example/echo_body -H "Content-Type: text/plain" -d '{"id": "notbase64"}'`
{"error":"illegal base64 data at input byte 8","code":3}%                                                                                                                                  ➜  

It panics:

➜  ./examples
panic: net/http: CloseNotify called after ServeHTTP finished

goroutine 7 [running]:
panic(0x7efa00, 0xc82000bd00)
    /usr/lib/go/src/runtime/panic.go:464 +0x3e6
net/http.(*response).CloseNotify(0xc8201101a0, 0x0)
    /usr/lib/go/src/net/http/server.go:1535 +0x9d
github.com/gengo/grpc-gateway/examples/examplepb.RegisterEchoServiceHandler.func2.1(0x7fdb33c0ae98, 0xc8201101a0, 0xc82000bbc0)
    /home/diogo/go/src/github.com/gengo/grpc-gateway/examples/examplepb/echo_service.pb.gw.go:127 +0x27
created by github.com/gengo/grpc-gateway/examples/examplepb.RegisterEchoServiceHandler.func2
    /home/diogo/go/src/github.com/gengo/grpc-gateway/examples/examplepb/echo_service.pb.gw.go:129 +0x132
@yugui
Copy link
Member

yugui commented Mar 3, 2016

Maybe fixed by #120

@yugui yugui closed this as completed Mar 3, 2016
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

No branches or pull requests

2 participants