consul icon indicating copy to clipboard operation
consul copied to clipboard

New WARN in 1.10.0 caused by shuffling the servers in the gRPC ClientConn pool

Open shellfu opened this issue 2 years ago • 33 comments

Note from @lkysow: I'm moving this to hashicorp/consul because the discuss post shows a user on EC2 also saw this error.

Overview of the Issue

New 1.10.0 on New K8s Cluster results in [WARN] agent: grpc: addrConn.createTransport failed to connect to {10.200.65.16:8300 0 consul-server-2.primary <nil>}. Err :connection error: desc = "transport: Error while dialing dial tcp 10.200.65.16:8300: operation was canceled". Reconnecting...

These WARNS appear in both the server and clients.

Reproduction Steps

  1. When running helm install with the following values.yml:
client:
  enabled: true
  grpc: true
connectInject:
  aclBindingRuleSelector: serviceaccount.name!=default
  default: false
  enabled: true
  metrics:
    defaultEnableMerging: true
    defaultEnabled: true
    defaultMergedMetricsPort: 20100
    defaultPrometheusScrapePath: /metrics
    defaultPrometheusScrapePort: 20200
  transparentProxy:
    defaultEnabled: true
    defaultOverwriteProbes: true
controller:
  enabled: true
dns:
  enabled: true
global:
  acls:
    createReplicationToken: true
    manageSystemACLs: true
  datacenter: primary
  enabled: true
  federation:
    createFederationSecret: true
    enabled: true
  gossipEncryption:
    secretKey: key
    secretName: consul-gossip-encryption-key
  image: hashicorp/consul:1.10.0
  imageEnvoy: envoyproxy/envoy-alpine:v1.18.3
  imageK8S: hashicorp/consul-k8s:0.26.0
  logJSON: true
  metrics:
    agentMetricsRetentionTime: 1m
    enableAgentMetrics: false
    enableGatewayMetrics: true
    enabled: true
  name: consul
  tls:
    enableAutoEncrypt: true
    enabled: true
    httpsOnly: true
    serverAdditionalDNSSANs:
    - '*.consul'
    - '*.svc.cluster.local'
    - '*.my.customdomain.com'
    verify: false
meshGateway:
  enabled: true
  service:
    enabled: true
    port: 443
    type: LoadBalancer
  wanAddress:
    port: 443
    source: Service
server:
  bootstrapExpect: 5
  connect: true
  disruptionBudget:
    enabled: true
    maxUnavailable: 2
  enabled: true
  extraConfig: "{\n  \"primary_datacenter\": \"primary\",\n  \"performance\": {\n
    \     \"raft_multiplier\": 3\n  },\n  \"dns_config\": {\n    \"allow_stale\":
    true,\n    \"cache_max_age\": \"10s\",\n    \"enable_additional_node_meta_txt\":
    false,\n    \"node_ttl\": \"1m\",\n    \"soa\": {\n        \"expire\": 86400,
    \n        \"min_ttl\": 30,\n        \"refresh\": 3600,\n        \"retry\": 600\n
    \   },\n    \"use_cache\": true\n}}"
  replicas: 5
  resources:
    limits:
      cpu: 500m
      memory: 10Gi
    requests:
      cpu: 500m
      memory: 10Gi
  storage: 10Gi
  updatePartition: 0
syncCatalog:
  default: true
  enabled: true
  nodePortSyncType: ExternalFirst
  syncClusterIPServices: true
  toConsul: true
  toK8S: true
ui:
  enabled: true
  metrics:
    baseURL: http://mon-kube-prometheus-stack-prometheus.monitoring.svc.cluster.local
    enabled: true
    provider: prometheus
  service:
    enabled: true
    type: NodePort

Expected behavior

WARNS should not be flooding the log and connections should be over 8301 not 8300

Environment details

If not already included, please provide the following:

  • consul-k8s version:0 .26.0
  • consul-helm version: 0.32.1
  • values.yaml used to deploy the helm chart: see above

Additional Context

It seems others are experiencing the same problem. https://discuss.hashicorp.com/t/grpc-warning-on-consul-1-10-0/26237

shellfu avatar Jul 12 '21 18:07 shellfu

Hi, based on https://discuss.hashicorp.com/t/grpc-warning-on-consul-1-10-0/26237 it sounds like this issue is not specific to Kubernetes. I'm going to move this to hashicorp/consul.

lkysow avatar Jul 12 '21 23:07 lkysow

Thank you for reporting this issue!

I was just running a Consul agent locally to debug a different issue and I noticed this problem happens at the same time as these 2 debug lines:

2021-07-13T20:26:20.707Z [DEBUG] agent.router.manager: Rebalanced servers, new active server: number_of_servers=2 active_server="a19bd98836ec.dc1 (Addr: tcp/172.20.0.2:8300) (DC: dc1)"
2021-07-13T20:26:20.707Z [WARN]  agent: grpc: addrConn.createTransport failed to connect to {172.20.0.3:8300 0 0cc9dd0254a2.dc1 <nil>}. Err :connection error: desc = "transport: Error while dialing dial tcp 172.20.0.3:8300: operation was canceled". Reconnecting...
2021-07-13T20:26:20.707Z [DEBUG] agent.router.manager: Rebalanced servers, new active server: number_of_servers=1 active_server="a19bd98836ec (Addr: tcp/172.20.0.2:8300) (DC: dc1)"

The problem seems to be that when we rebalance the servers the active transport is cancelled, which causes this error to be printed.

dnephin avatar Jul 13 '21 20:07 dnephin

Is the issue here that the behavior is potentially incorrect, or that a common occurrence is erroneously categorized at WARN log level?

mikemorris avatar Jul 14 '21 14:07 mikemorris

I've installed in a couple other locations with the same chart/values as above and in the same datacenter the warn messages are for the other consul-servers in the cluster. This occurs if the cluster is WAN federated or not, that doesn't appear to have an impact.

Currently, trying to track a couple of network issues I have been experiencing in consul 1.10.

I am trying to obtain more evidence but I deleted the 1.10 cluster and went back to 1.8.4 and it did not appear to have the WARN. Can this be ignored? Not sure yet.

shellfu avatar Jul 20 '21 20:07 shellfu

seeing an exact mirror of of this problem on a small development cluster running on Raspberry PI 4's in a very basic configuration all running consul 1.10.1

the errors in my case are the server taking to itself,

eg: my 3 raft servers are made up of 3 nodes - called:

nog wesley jake

Node ID Address State Voter RaftProtocol wesley.no-dns.co.uk 5e8a186b-adb5-ebba-eeb4-e10656568adf 10.11.216.81:8300 leader true 3 nog.no-dns.co.uk 086a7491-bf09-c7e2-9151-74c817ffb74c 10.11.216.182:8300 follower true 3 jake.no-dns.co.uk aa37ec78-d438-8726-77e5-c5619dfb054a 10.11.216.234:8300 follower true 3

in nog's log Jul 21 10:21:35 nog consul[5613]: 2021-07-21T10:21:35.048Z [WARN] agent: grpc: addrConn.createTransport failed to connect to {10.11.216.182:8300 0 nog.no-dns.co.uk.bathstable }. Err :connection error: desc = "transport: Error while dialing dial tcp 10.11.216.182:8300: operation was canceled". Reconnecting...

the IP address 10.11.216.182 is actually the IP address of the host 'nog' - so the error is talking to itself

on the host 'jake' the log shows the same failure to connect to the host nog Jul 21 10:17:17 jake consul[7781]: 2021-07-21T10:17:17.833Z [WARN] agent: grpc: addrConn.createTransport failed to connect to {10.11.216.182:8300 0 nog.no-dns.co.uk.bathstable }. Err :connection error: desc = "transport: Error while dialing dial tcp 10.11.216.182:8300: operation was canceled". Reconnecting...

on the host wesley (leader)

Jul 21 10:19:19 wesley consul[15814]: 2021-07-21T10:19:19.779Z [WARN] agent: grpc: addrConn.createTransport failed to connect to {10.11.216.81:8300 0 wesley.no-dns.co.uk.bathstable }. Err :connection error: desc = "transport: Error while dialing dial tcp 10.11.216.81:8300: operation was canceled". Reconnecting...

the 10.11.216.81 IP address it's failing to talk to is wesley - itself in this case.

ikonia avatar Jul 21 '21 10:07 ikonia

Yeah, that is what I am seeing. It's the local cluster that is emitting these messages and FLOODING the logs

shellfu avatar Jul 21 '21 16:07 shellfu

I see the same issue. Three node cluster running on VMs (Cent 8).

Consul v1.10.0 Revision 27de64da7 Running on Cent 8 VMs.

All three nodes sporadically spit out an error about connecting to one of the other master nodes.

agent: grpc: addrConn.createTransport failed to connect to {10.248.14.54:8300 0 consul02.c.blah.internal <nil>}. Err :connection error: desc = "transport: Error while dialing dial tcp 10.248.14.54:8300: operation was canceled". Reconnecting...

kornface13 avatar Jul 23 '21 02:07 kornface13

I went ahead and did more installation tests.

I installed Consul 1.10.1 and Chart 0.32.1 and backed down the Consul and Chart version all the way to 1.8.4 and 0.26.0 as I am also experiencing other problems that are not related to this issue.

The WARNS appear in the latest 1.10.x versions and they are emitted in both the local datacenter as well as a federated environment using mesh gateways.

shellfu avatar Jul 26 '21 15:07 shellfu

We are also seeing similar errors but there seems to be no issue with the cluster itself, we are running consul v1.10.1 on OL8 VM's.

sri4kanne avatar Aug 06 '21 14:08 sri4kanne

@ikonia I'm running Consul on two Ras Pis, and ran into this issue couple of days ago as well. In case you haven't found a solution, I seems to find the cause for my issue.

I first noticed the inconsistency in member status shown on each Pi. As you can see from snippets below, Pi 1 seems to think that 02 is leaving the cluster, and 02 thinks it's still in it. So I restarted the consul service on 02 and that fixed the issue.

I think the problem was caused due to starting services on both Pis at the same time and the nodes didn't negotiate properly and somehow that caused this weird bug. I use Ansible for staging the node and manage configs on them, and whenever I changed the configs, it restarts the services at the same time on all nodes and that's not a good idea .... (duh ... ).

I'm not sure what you setup is, but maybe try to spin up the nodes one by one, which solved the problem for me.

raspi01:
Node           Address            Status   Type    Build   Protocol  DC     Segment
raspi01.raspi  192.168.1.10:8302  alive    server  1.10.1  2         raspi  <all>
raspi02.raspi  192.168.1.11:8302  leaving  server  1.10.1  2         raspi  <all>

raspi02:
Node           Address            Status  Type    Build   Protocol  DC     Segment
raspi01.raspi  192.168.1.10:8302  alive   server  1.10.1  2         raspi  <all>
raspi02.raspi  192.168.1.11:8302  alive   server  1.10.1  2         raspi  <all>

therealhanlin avatar Aug 08 '21 19:08 therealhanlin

Restarts in the way you describe unfortunately does not solve the problem here. The clusters appear to be healthy otherwise, but this is flooding logs and I do not think we have received a response as to if the messages are indicative of an issue or is something that can be ignored and waiting for a patch.

shellfu avatar Aug 09 '21 16:08 shellfu

I believe these messages can be ignored. We periodically rebalance servers in the connect pool, and it looks like doing so is causing gRPC to emit these warnings. It seems like gRPC is reconnecting after the rebalance, so likely we can move these messages to INFO instead of WARN, but we'll need to do more investigation to be sure.

dnephin avatar Aug 09 '21 16:08 dnephin

+1 It seems like not ok.

consul v1.10.1

isality avatar Aug 14 '21 19:08 isality

we're having the same issue on ent version, will try to raise support ticket there

avoidik avatar Sep 06 '21 10:09 avoidik

:100: this should be moved to an info level log, normal system behavior that doesn't result in any degradation and self heals should not be something we are warned about.

drawks avatar Sep 17 '21 16:09 drawks

I have the same issue after upgraded to 1.10.2.

Peter-consul avatar Oct 01 '21 20:10 Peter-consul

@dnephin Is there any chance to fix this in an upcoming release?

weastur avatar Oct 04 '21 12:10 weastur

To clarify our current understanding of this: this is not a bug, but instead a misclassified log message (that shouldn't be WARN).

Per @dnephin:

I believe these messages can be ignored. We periodically rebalance servers in the connect pool, and it looks like doing so is causing gRPC to emit these warnings. It seems like gRPC is reconnecting after the rebalance, so likely we can move these messages to INFO instead of WARN, but we'll need to do more investigation to be sure.

In this case, the aforementioned "need to do more investigation" is about how to make the change to reduce verbosity, not about the cause or whether there's a bug. The change requires some investigation because the message is emitted by gRPC, not Consul.

jkirschner-hashicorp avatar Oct 15 '21 00:10 jkirschner-hashicorp

Exactly this same error on 1.11.1 bare metal/ centos 7

adamw-linadm avatar Jan 11 '22 14:01 adamw-linadm

If this log message was coming directly from Consul this would be much easier to fix. Unfortunately the log message is coming from a library (gRPC), which makes it a bit harder to fix.

I think we have two options for addressing this:

  1. change all gRPC WARN messages to INFO
  2. change how we modify the grpc ClientConnPool so that it does not warn

Option 1 is pretty safe, but I'm not sure if it fixes much. There will still be an INFO log message that is printed periodically. I guess it is slightly better to print this as an INFO than a WARN. The downside is that other gRPC WARN messages may not be visible enough in logs at INFO level.

Option 2 is much more involved, but is likely a safer long term fix. I believe the cause of this warning is this code: https://github.com/hashicorp/consul/blob/d20230fac1e89678ba6f5e26bad4d2fff99fe9f2/agent/grpc/resolver/resolver.go#L283-L287

If we trace those UpdateState calls, we'll see we can end up in the code that logs that warning. My rough understanding is that by updating the client conn state we are cancelling the dial operation, which prints this message. It may be that by calling UpdateState twice like this is what triggers the warning. Under normal operation I guess the dial would complete and we wouldn't see a warning. This also shows why we can't just hide the message, because if the dial operation was failing for some other reason, we'd want to know about it. The "further investigation" would be to see if we could remove the need to call UpdateState twice, and to confirm that is sufficient to prevent the warning.

dnephin avatar Jan 11 '22 21:01 dnephin

We're seeing a pretty healthy amount of these messages as well across our clusters. Keeping our eyes on this.

Given the above, option 2 is definitely our preference. Not sure we want to even get a message in this case unless it's something to be concerned about

idrennanvmware avatar Jan 22 '22 13:01 idrennanvmware

Still happening on 1.11.2 running on my homelab.

+1 to Option 2

danlsgiga avatar Jan 26 '22 22:01 danlsgiga

Can we ignore this error if everything is working as expected ? or Do we need to concern about this warning/error ?

NagenderPulluri avatar Feb 24 '22 13:02 NagenderPulluri

Hey @nagender1005

Yes you can ignore this warning if everything is working as expected. Per earlier in this thread:

I believe these messages can be ignored. We periodically rebalance servers in the connect pool, and it looks like doing so is causing gRPC to emit these warnings. It seems like gRPC is reconnecting after the rebalance, so likely we can move these messages to INFO instead of WARN, but we'll need to do more investigation to be sure.

Hope this helps!

Amier3 avatar Feb 28 '22 16:02 Amier3

Still happening in Consul v1.11.3 as well.

chrisvanmeer avatar Mar 01 '22 09:03 chrisvanmeer

Still happening in Consul v1.12.0 .

scottnemes avatar Apr 28 '22 18:04 scottnemes

we are approaching this error being open for a year now ? is there a clear understanding of it and an plan to resolve it now, even if it's just a miss-classified error it should be easy to remediate and remove the confusion

ikonia avatar May 03 '22 13:05 ikonia

Hey everyone, sorry for the inconvenience but as stated above, these WARNs are being emitted from the grpc library itself and we cannot easily suppress them without potentially hiding other valid WARN logs from grpc.

We are looking into Option 2 as outlined by @dnephin above but it is still an investigation in progress.

kisunji avatar May 04 '22 18:05 kisunji

Consul v1.12.0 Revision 09a8cdb4

May 17 11:22:15 master1 consul[1095]: 2022-05-17T11:22:15.647+0300 [WARN] agent: [core]grpc: addrConn.createTransport failed to connect to {fsn1-10.44.0.4:8300 master3.fsn1 0 }. Err: connection error: desc = "transport: Error while dialing dial tcp 10.44.0.2:0->10.44.0.4:8300: operation was canceled". Reconnecting...

cr0c0dylus avatar May 17 '22 09:05 cr0c0dylus

Consul v1.12.3 Revision 2308c75e

Jul 14 14:38:12 master2 consul[883807]: agent: [core]grpc: addrConn.createTransport failed to connect to {hel1-95.XX.XX.47:8300 master2.hel1 0 }. Err: connection error: desc = "transport: Error while dialing dial tcp 95.XX.XX.47:0->95.XX.XX.47:8300: operation was canceled". Reconnecting...

Jul 14 14:49:07 master2 consul[883807]: 2022-07-14T14:49:07.549+0300 [WARN] agent: [core]grpc: addrConn.createTransport failed to connect to {hel1-95.XX.XX.194:8300 master3.hel1 0 }. Err: connection error: desc = "transport: Error while dialing dial tcp 95.XX.XX.47:0->95.XX.XX.194:8300: operation was canceled". Reconnecting...

cr0c0dylus avatar Jul 14 '22 11:07 cr0c0dylus