datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

nil-pointer in parseKubeletPodlist from pkg/autodiscovery/providers/kubelet.go

Open hermanbanken opened this issue 5 years ago • 3 comments

Describe what happened: Our dd-agent reported this error (once):

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x157241a]

goroutine 253 [running]:
github.com/DataDog/datadog-agent/pkg/autodiscovery/providers.parseKubeletPodlist(0xc000ab48c0, 0x1b, 0x1b, 0x1b, 0x0, 0x0, 0x0, 0x2)
	/.omnibus/src/datadog-agent/src/github.com/DataDog/datadog-agent/pkg/autodiscovery/providers/kubelet.go:93 +0x54c
github.com/DataDog/datadog-agent/pkg/autodiscovery/providers.(*KubeletConfigProvider).Collect(0xc00036ccd0, 0x0, 0x3fbd57, 0xc00347d7b0, 0x150, 0x7)
	/.omnibus/src/datadog-agent/src/github.com/DataDog/datadog-agent/pkg/autodiscovery/providers/kubelet.go:61 +0xc2
github.com/DataDog/datadog-agent/pkg/autodiscovery.(*configPoller).collect(0xc0003c4370, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0)
	/.omnibus/src/datadog-agent/src/github.com/DataDog/datadog-agent/pkg/autodiscovery/config_poller.go:121 +0x60
github.com/DataDog/datadog-agent/pkg/autodiscovery.(*configPoller).poll(0xc0003c4370, 0xc000338870)
	/.omnibus/src/datadog-agent/src/github.com/DataDog/datadog-agent/pkg/autodiscovery/config_poller.go:93 +0x3b9

We are at 7.17.0 (old, I know), which points me to this code: https://github.com/DataDog/datadog-agent/blob/6eb25b4eb91991b09051882c258fcb726a5ab5b1/pkg/autodiscovery/providers/kubelet.go#L93

I looked at the latest release and see no significant changes in the code paths there, so I guess that Status could still be a nil-pointer in the newer releases.

I'm reporting this as a courtesy. If you feel that one occurrence without reproduction is not problematic then feel free to close it. As it happened once, our agents seem to have recovered perfectly and are still running. Plus, we will be updating our agent soon to a newer version.

Describe what you expected: No errors.

Steps to reproduce the issue: No idea how this can occur. Why would status be nil?

Use Docker container for 7.17 (docker pull datadog/agent:7.17.0) and digest sha256:a140ab4f8db24333f68cbb5f1ec43ea76c2812f47c26622e10b1ca0db72c7861.

Additional environment details (Operating System, Cloud provider, etc): GKE Kubernetes v1.16.15-gke.7800, so on Google infrastructure.

hermanbanken avatar Mar 03 '21 07:03 hermanbanken

Hey @hermanbanken

It looks like we fixed a panic that seems related in the version 7.24: https://github.com/DataDog/datadog-agent/blob/master/CHANGELOG.rst#7240--6240

Fix random panic in Kubelet searchPodForContainerID due to concurrent modification of pod.Status.AllContainers

PR: https://github.com/DataDog/datadog-agent/pull/6685

Please upgrade and let us know how it goes!

Thanks!

Simwar avatar Mar 15 '21 16:03 Simwar

This issue has been automatically marked as stale because it has not had activity in the past 15 days.

It will be closed in 30 days if no further activity occurs. If this issue is still relevant, adding a comment will keep it open. Also, you can always reopen the issue if you missed the window.

Thank you for your contributions!

dd-octo-sts avatar Oct 21 '25 10:10 dd-octo-sts

Automatically closed due to inactivity.

jacjtito avatar Jan 04 '26 17:01 jacjtito