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

nil pointer dereference for workersRegistered in Prometheus emitter #3524

Closed
cirocosta opened this issue Mar 15, 2019 · 0 comments · Fixed by #3525
Closed

nil pointer dereference for workersRegistered in Prometheus emitter #3524

cirocosta opened this issue Mar 15, 2019 · 0 comments · Fixed by #3525

Comments

@cirocosta
Copy link
Member

Hey,

In the last PR that got merged regarding updating the workersRegistered metric (see #3076), I missed providing the instantiation of the GaugeVec to the emitter struct.

Naturally, this leads Prometheus scraping to make the whole web process die with a SIGSEGV:

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

goroutine 45 [running]:
github.com/prometheus/client_golang/prometheus.(*GaugeVec).GetMetricWithLabelValues(...)
	/tmp/build/70f2e240/gopath/pkg/mod/github.com/prometheus/client_golang@v0.9.2/prometheus/gauge.go:183
github.com/prometheus/client_golang/prometheus.(*GaugeVec).WithLabelValues(0x0, 0xc0082f4dd0, 0x1, 0x1, 0xc0059674c8, 0x1c3da01)
	/tmp/build/70f2e240/gopath/pkg/mod/github.com/prometheus/client_golang@v0.9.2/prometheus/gauge.go:215 +0x27
github.com/concourse/concourse/atc/metric/emitter.(*PrometheusEmitter).workersRegisteredMetric(0xc00043fc20, 0x24ac120, 0xc003df83c0, 0x1c46bce, 0xc, 0x192bcc0, 0xc004121970, 0x1c3984f, 0x2, 0xc0027e2900, ...)
	/tmp/build/70f2e240/concourse/atc/metric/emitter/prometheus.go:473 +0x100
github.com/concourse/concourse/atc/metric/emitter.(*PrometheusEmitter).Emit(0xc00043fc20, 0x24ac120, 0xc003df83c0, 0x1c46bce, 0xc, 0x192bcc0, 0xc004121970, 0x1c3984f, 0x2, 0xc0027e2900, ...)
	/tmp/build/70f2e240/concourse/atc/metric/emitter/prometheus.go:337 +0x150
github.com/concourse/concourse/atc/metric.emitLoop()
	/tmp/build/70f2e240/concourse/atc/metric/emit.go:142 +0x133
created by github.com/concourse/concourse/atc/metric.Initialize
	/tmp/build/70f2e240/concourse/atc/metric/emit.go:102 +0x1f2

The fix is rather simple - give the instantiated object to the PrometheusEmitter instance and that's fixed.

This issue is meant more to document how little things like this, at the moment, are able to greatly affect the execution of web instances - call out to #2896

@cirocosta cirocosta changed the title metrics: nil pointer dereference for workersState in Prometheus emitter nil pointer dereference for workersRegistered in Prometheus emitter Mar 15, 2019
cirocosta pushed a commit that referenced this issue Mar 15, 2019
fixes #3524

Signed-off-by: Ciro S. Costa <cscosta@pivotal.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant