SkyAPM / go2sky

Distributed tracing and monitor SDK in Go for Apache SkyWalking APM
https://skywalking.apache.org/
Apache License 2.0
448 stars 123 forks source link

close gRPCReporter error #129

Closed lokichoggio closed 3 years ago

lokichoggio commented 3 years ago

when close gRPCReporter, error like this

go2sky-gRPC2021/09/22 17:03:57 send closing error rpc error: code = Canceled desc = grpc: the client connection is closing go2sky-gRPC2021/09/22 17:03:57 rpc error: code = Canceled desc = grpc: the client connection is closing

if r.sendCh != nil,r.closeStream and r.closeGRPCConn (line 268) maybe called after r.closeGRPCConn (line 236)

https://github.com/SkyAPM/go2sky/blob/b16c9f07fef6a007b94f940566af4374a5bf44dc/reporter/grpc.go#L232-L237

https://github.com/SkyAPM/go2sky/blob/b16c9f07fef6a007b94f940566af4374a5bf44dc/reporter/grpc.go#L247-L273

lokichoggio commented 3 years ago

add else

func (r *gRPCReporter) Close() {
    if r.sendCh != nil {
        close(r.sendCh)
    } else {
        r.closeGRPCConn()
    }
}
wu-sheng commented 3 years ago

You could send a pull request if you like. @arugal could review from there.