grpc/grpc-web

`end` event occasionally STILL not emitted?

Closed this issue · 6 comments

Hi,

I have upgraded my project to 1.0.4 so that I can eliminate the workaround taken from issue #289 needed for being notified about end of server-side streaming. In my project I use nginx (grpc-web enabled), C# gRPC service and a common.js+dts client.

Unfortunately, this bug still seems to be not fixed: sometimes the end event is just not fired.

Before raising this issue, I installed the echo example (https://github.com/grpc/grpc-web/tree/1.0.4#advanced-demo-browser-echo-app) using win10 + docker desktop. I started it in chrome, but I never got a console message of stream end signal received, so the issue there is even worse. Only Received metadata message is logged on status event, as the screenshot below shows.
image

I believe the end event handler in below code sample taken from the echo example should have also been called at end of each streaming response.

o.EchoApp.prototype.repeatEcho = function(e, t) {
        o.EchoApp.addLeftMessage(e),
        t > o.EchoApp.MAX_STREAM_MESSAGES && (t = o.EchoApp.MAX_STREAM_MESSAGES);
        var r = new this.ctors.ServerStreamingEchoRequest;
        r.setMessage(e),
        r.setMessageCount(t),
        r.setMessageInterval(o.EchoApp.INTERVAL);
        var n = this.echoService.serverStreamingEcho(r, {
            "custom-header-1": "value1"
        })
          , g = this;
        n.on("data", function(e) {
            o.EchoApp.addRightMessage(e.getMessage())
        }),
        n.on("status", function(e) {
            g.handlers.checkGrpcStatusCode(e),
            e.metadata && (console.log("Received metadata"),
            console.log(e.metadata))
        }),
        n.on("error", function(e) {
            o.EchoApp.addRightMessage("Error code: " + e.code + ' "' + e.message + '"')
        }),
        n.on("end", function() {
            console.log("stream end signal received")
        })
    }

I would appreciate if someone could check this.

Has anyone the same issue with the echo example? Or with 'end' event of server-side streaming in general?

I have noticed the same issue with both the echo example, and originally in my own code.

Yup, still happening for me with a real gRPC service in Golang with Envoy 1.10 at the ingress (via Contour v0.14.1).

me too, i have 2 issues:

  1. end event never occurred for the echo example on my macbook pro
  2. both end and status event never occurred for the echo example, when envoy and server deployed in the k8s

another hint: when deployed in the k8s, the request doesn't end automatically after the client have successfully received all the messages, Chrome DevTools shows the request is not finished yet:

image

and the request will end up in a failed status after a while

image

this doesn't happen when running on my macbook pro.

I guess may be the response EOF is dropped during transmitting somehow?

Closing this for now. If this is still an issue, please open a new one.