what's the frequency of the letter "o" in:
q: connection incorrectly preserved when using grpc on istio we've seen some odd behaviour on our kubernetes cluster. we have two test applications that speak grpc. one sends a subscription message and the other sends back a stream of responses. the envisaged behaviour is that this stream stays up until cancelled. however, we were finding situations in which the server thought it was sending updates but the client didn't receive them. narrowing this down further led to a reproducible test case:


*

*if the service is configured as grpc in kubernetes i.e. grpc- in the port name.

*you set up the streaming

*you then reboot the server


then the observed behaviour was that the client never saw the connection drop, presumably because its connection is to the istio proxy and not the destination server. however, without the information that the connection has dropped, it can't re-establish the connection.
has anyone seen this behaviour? what do we need to configure in istio to work around this? (we can fix the problem simply by changing the service to have a port name that doesn't begin with "grpc-" but that works by disabling istio's grpc functionality.)
edit:
kubernetes: 1.14.6
istio: 1.3.6
there's no explicit destinationrule set up, although various things have been tried we couldn't find anything that changed this behaviour.

a: this could be prevented by idletimeout setting in destinationrule.
according to istio documentation about idletimeout:

the idle timeout for upstream connection pool connections. the idle timeout is defined as the period in which there are no active requests. if not set, there is no idle timeout. when the idle timeout is reached the connection will be closed. note that request based timeouts mean that http/2 pings will not keep the connection alive. applies to both http1.1 and http2 connections.

so if you make destinationrule like this:
apiversion: networking.istio.io/v1alpha3
kind: destinationrule
metadata:
  name: grpc-iddletimeout-policy
spec:
  host: grpcservice.servicenamespace.svc.cluster.local
  trafficpolicy:
    connectionpool:
      http:
        idletimeout: 2m

this should close the any http/2 connection from istio envoy proxy side after being idle for 2 minutes for grpcservice in servicenamespace namespace.

istio does have tcpkeepalive as well but i'm not sure if it will work with grpc connection and your configuration.
apiversion: networking.istio.io/v1alpha3
kind: destinationrule
metadata:
  name: grpc-iddletimeout-policy
spec:
  host: grpcservice.servicenamespace.svc.cluster.local
  trafficpolicy:
    connectionpool:
      tcp:
        connecttimeout: 30ms
        tcpkeepalive:
          time: 7200s
          interval: 75s
      http:
        idletimeout: 2m

note that the tcpkeepalive setting is applied at the tcp level while idletimeout at http/2 level. 
you can check here to see what specific tcpkeepalive options are available.
there is also an article about using grpc with connection keepalive.
hope it helps.

user
The text includes one hundred and seventy-seven "o"s in total.
assistant