Server is crashing
Hello,
I'm trying to write a simple grpc server in D, similar to the classic helloworld example.
I'm able to compile and start it just fine, but once I send a client request the server crashes.
The error is:
2020-07-19 18:54:13 (21) [info] onPreface - server received preface: Http2Session@132645144323280{l:127.0.0.1:50051 <-> r:127.0.0.1:33236,sendWindow=65535,recvWindow=65535,streams=0,NOT_CLOSED} - grpc-dlang/source/grpc/GrpcServer.d:64
2020-07-19 18:54:13 (21) [info] onNewStream - server created new stream: 1 - grpc-dlang/source/grpc/GrpcServer.d:69
2020-07-19 18:54:13 (21) [info] onNewStream - server created new stream headers: POST{u=http://127.0.0.1:50051/helloworld.Greeter/SayHello,HTTP/2.0,h=4,cl=-1} - grpc-dlang/source/grpc/GrpcServer.d:70
2020-07-19 18:54:13 (21) [info] onNewStream - server created new stream: 3 - grpc-dlang/source/grpc/GrpcServer.d:69
2020-07-19 18:54:13 (21) [info] onNewStream - server created new stream headers: POST{u=http://127.0.0.1:50051/helloworld.Greeter/SayHello,HTTP/2.0,h=4,cl=-1} - grpc-dlang/source/grpc/GrpcServer.d:70
Segmentation fault
I'm using the latest docker Dlang2 image to build the application and ghz as client.
More details and the step to reproduce the crash are in this ticket: https://github.com/LesnyRumcajs/grpc_bench/issues/30
Thanks!
We will have a look at this soon.
I made a simple test in pure Linux (without using your docker). The server works well. Here is the log:
2020-Jul-20 11:50:54.097364 | 5011 | trace | GreeterImpl.SayHello | request: it's not as performant as we expected, reply: Hello it's not as performant as we expected | source/GreeterImpl.d:15
2020-Jul-20 11:50:54.0974133 | 5011 | trace | GreeterImpl.SayHello | request: it's not as performant as we expected, reply: Hello it's not as performant as we expected | source/GreeterImpl.d:15
2020-07-20 11:50:54 (5011) [info] onNewStream - server created new stream: 2107 - ../../source/grpc/GrpcServer.d:69
2020-07-20 11:50:54 (5011) [info] onNewStream - server created new stream headers: POST{u=http://127.0.0.1:30051/helloworld.Greeter/SayHello,HTTP/2.0,h=4,cl=-1} - ../../source/grpc/GrpcServer.d:70
2020-07-20 11:50:54 (5011) [info] onNewStream - server created new stream: 2109 - ../../source/grpc/GrpcServer.d:69
2020-07-20 11:50:54 (5011) [info] onNewStream - server created new stream headers: POST{u=http://127.0.0.1:30051/helloworld.Greeter/SayHello,HTTP/2.0,h=4,cl=-1} - ../../source/grpc/GrpcServer.d:70
The command line:
ghz --proto=./proto/helloworld.proto --call=helloworld.Greeter.SayHello --insecure --duration 1s -d "{\"name\":\"it's not as performant as we expected\"}" 127.0.0.1:30051
···
It seems more tests are needed for docker.
Thanks for the quick response!
I've played around with different images and when using dlang2/ldc-ubuntu:1.22.0 the server doesn't crash anymore.
My only remaining issue is that ghz is complaining about content-type:
Error distribution:
[1861] rpc error: code = Unknown desc = OK: HTTP status code 200; transport: missing content-type field
[4] rpc error: code = Canceled desc = grpc: the client connection is closing
[46] rpc error: code = Unavailable desc = transport is closing
En, we also notice these error messages. We will check them as soon as possible. Thanks for your report.
#22 and #23 will fix this.