In server-side streaming, how does an ungraceful disconnection by a client
get communicated back to the server?
If, for example, I have an application-level ping rpc, an then I unplug a
network cable, after a few unsuccessful pings, the ServerCallStreamObserver
will report the error. Without those pings, I am not receiving a
notification. Using a NettyServerBuilder with 10s keepAlive and 500ms
keepAliveTimeout, and code similar to this:
Context oldCurrent = Context.current();
Context previous = oldCurrent.attach();
Context.current().addListener(context -> log.error("Cancel received!"),
executorService);
try {
while (!shutdown && !Thread.interrupted()) {
next = queue.poll();
if (next == null) {
log.debug("Queue is empty, waiting before next poll()");
Thread.sleep(1000);
// if sending an empty message here, the cancellation will be
picked up quickly
//serverCallStreamObserver.onNext(PING);
} else {
serverCallStreamObserver.onNext(next);
}
}
} (catch and finally clauses snipped)
listeners attached to any of the above contexts never fire; what might I be
missing in order to notify the application of a broken connection?
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/50a55b08-7bb2-4d7e-965d-3cbd58d02483n%40googlegroups.com.