calico: Memory leak on version 3.29.0

Expected Behavior

Calico uses resources correctly and without memory leaks.

Current Behavior

We are observing a memory leak on version calico 3.29.0. The problem with the account is observed on the controller and nodes. image image log.txt

Also, we noticed an increase in the exec-time (felix_exec_time_micros) and an increase in Internal Dataplane Msg Batch Size (felix_int_dataplane_apply_time_seconds) image image image

calico-node-log.txt

Steps to Reproduce (for bugs)

  1. Install calico version 3.29.0
  2. after 3-7 days check metrics memory utilization of pods calico and check increase memory utilization
  3. after 3-7 days check increase metrics of felix_exec_time_micros and felix_int_dataplane_apply_time_seconds

Your Environment

  • Calico version is 3.29.0 on ebpf dataplane.
  • Felix configuration
apiVersion: crd.projectcalico.org/v1
kind: FelixConfiguration
metadata:
  annotations:
  name: default
spec:
  bpfEnabled: true
  bpfExternalServiceMode: Tunnel
  bpfLogLevel: ""
  logSeverityScreen: Debug
  prometheusMetricsEnabled: true
  reportingInterval: 0s
  vxlanEnabled: true
  vxlanPort: 4799
  vxlanVNI: 4096
  • Orchestrator version (e.g. kubernetes, mesos, rkt): kubernetes v1.22.15
  • Operating System and version: Ubuntu 20.04.4 LTS, kernel: 5.15.0-67-generic, cri: containerd://1.5.5 calico-3.29.0-manifest.yaml.txt

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 16
  • Comments: 22 (12 by maintainers)

Most upvoted comments

That’s great news. We’re still scheduling the release but it should be in a week or two. (Our release process is a bit slow because we include CVE updates and testing.)

@cdugal-db We are hoping to get the release out this week.

@tomastigera Hi, were you able to view the profile?

@tomastigera

Hello, I received the profile file. Attached to message.

I set in KubeControllersConfiguration debugProfilePort (I think it was useless for me). I set in FelixConfiguration

debugHost: 127.0.0.1
debugPort: 9792
debugMemoryProfilePath: /tmp/felix-mem.pprof
apiVersion: crd.projectcalico.org/v1
kind: KubeControllersConfiguration
metadata:
  name: default
spec:
  controllers:
    namespace:
      reconcilerPeriod: 5m0s
    node:
      leakGracePeriod: 15m0s
      reconcilerPeriod: 5m0s
      syncLabels: Enabled
    policy:
      reconcilerPeriod: 5m0s
    serviceAccount:
      reconcilerPeriod: 5m0s
    workloadEndpoint:
      reconcilerPeriod: 5m0s
  debugProfilePort: 9792
  etcdV3CompactionPeriod: 10m0s
  healthChecks: Enabled
  logSeverityScreen: Info
  prometheusMetricsPort: 9094

---
apiVersion: crd.projectcalico.org/v1
kind: FelixConfiguration
metadata:
  generation: 13
  name: default
spec:
  bpfEnabled: true
  bpfExternalServiceMode: Tunnel
  bpfLogLevel: ""
  debugHost: 127.0.0.1
  debugMemoryProfilePath: /tmp/felix-mem.pprof
  debugPort: 9792
  logSeverityScreen: Info
  prometheusMetricsEnabled: true
  reportingInterval: 0s
  vxlanEnabled: true
  vxlanPort: 4799
  vxlanVNI: 4096

On node

$ ss -ntpl | grep 9792
LISTEN    0         30000            127.0.0.1:9792             0.0.0.0:*        users:(("calico-node",pid=11099,fd=11))                                        
$ ps -aux | grep calico
root      6857  0.0  0.3 1943344 62516 ?       Sl   13:15   0:00 calico-node -status-reporter
root      6859  0.0  0.3 2091320 64696 ?       Sl   13:15   0:00 calico-node -allocate-tunnel-addrs
root      6860  0.0  0.3 1944112 62964 ?       Sl   13:15   0:00 calico-node -monitor-addresses
root      6861  0.0  0.3 1943856 59552 ?       Sl   13:15   0:00 calico-node -monitor-token
root     11099  1.9  0.5 3419776 95608 ?       Sl   13:18   0:13 calico-node -felix
root     19466  0.0  0.0   3444   724 ?        R+   13:30   0:00 grep --color=auto calico
$ kill -SIGUSR1 11099

felix-mem.zip

@legolego621 would you be able to provide us with some memory profiles?

KubeControllersConfiguration has a DebugProfilePort field that enables a profile server: https://github.com/caseydavenport/calico/blob/627acd5bd2ab181df998d0933e627149ef9c38bf/api/pkg/apis/projectcalico/v3/kubecontrollersconfig.go#L66-L68

For felix, set DebugMemoryProfilePath and then send felix a sigusr1 or enable the debug server in felix by setting DebugPort/Host