Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log a Warning in case there is a nil from Fargate #135

Merged
merged 2 commits into from
Jul 6, 2022

Conversation

kang-makes
Copy link
Contributor

We have a ticket for a nil pointer dereference:

[WARN] computing Storage Driver stats: only devicemapper is supported
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x240 pc=0x7f5640]

goroutine 1 [running]:
github.com/newrelic/nri-docker/src/raw/aws.(*FargateFetcher).getFargateContainerMetrics(0xc4202ae880, 0xc42000e430, 0xc42028d480, 0x832901)
  /go/src/github.com/newrelic/nri-docker/src/raw/aws/fargate_fetcher.go:112 +0x4b0
github.com/newrelic/nri-docker/src/raw/aws.(*FargateFetcher).fargateStatsFromCacheOrNew(0xc4202ae880, 0xc42000e430, 0x0, 0x0)
  /go/src/github.com/newrelic/nri-docker/src/raw/aws/fargate_fetcher.go:76 +0x20a
github.com/newrelic/nri-docker/src/raw/aws.(*FargateFetcher).Fetch(0xc4202ae880, 0xc4200ab1e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
  /go/src/github.com/newrelic/nri-docker/src/raw/aws/fargate_fetcher.go:54 +0x6a
github.com/newrelic/nri-docker/src/biz.(*MetricsFetcher).Process(0xc4202ae940, 0xc4202e2ae0, 0x2b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
  /go/src/github.com/newrelic/nri-docker/src/biz/metrics.go:145 +0x1e4
github.com/newrelic/nri-docker/src/nri.(*ContainerSampler).SampleAll(0xc4201180c0, 0xb5f7a0, 0xc42001a018, 0xc4200a09a0, 0x0, 0x0)
  /go/src/github.com/newrelic/nri-docker/src/nri/sampler.go:89 +0x21c
main.main()
  /go/src/github.com/newrelic/nri-docker/src/docker.go:92 +0x647

This should fix the issue and warn us from where does this nil come from.

@kang-makes kang-makes requested a review from a team July 5, 2022 15:34
Copy link
Contributor

@gsanchezgavier gsanchezgavier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM it would be nice to add at least the test case for this failure mode

@kang-makes
Copy link
Contributor Author

Because of the way it is developed I cannot mock the HTTP Server so I cannot test it properly.

I filed ticket #136 for that.

Copy link
Contributor

@sigilioso sigilioso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kang-makes kang-makes merged commit dca5270 into master Jul 6, 2022
@kang-makes kang-makes deleted the fix/warn-nil-from-fargate branch July 6, 2022 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants