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

Fix segmentation fault on missing credentials #42

Merged
merged 1 commit into from
Nov 23, 2018
Merged

Fix segmentation fault on missing credentials #42

merged 1 commit into from
Nov 23, 2018

Conversation

alexey-medvedchikov
Copy link
Contributor

@alexey-medvedchikov alexey-medvedchikov commented Nov 19, 2018

If no credentials supplied stackdriver_exporter binary goes segfaulted:

# ./stackdriver_exporter --google.project-id aproject --monit
oring.metrics-type-prefixes container.googleapis.com --stackdriver.http-timeout=10s
INFO[0000] Starting stackdriver_exporter (version=0.5.1, branch=master, revision=c36707967ebec2fb8977a54003797e5148c24936)  source="stackdriver_exporter.go:122"
INFO[0000] Build context (go=go1.10.5, user=root@857d0832fe06, date=20181119-16:33:41)  source="stackdriver_exporter.go:123"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x7b5e47]

goroutine 1 [running]:
main.createMonitoringService(0xc420049f38, 0x2, 0x2)
	/go/src/github.com/frodenas/stackdriver_exporter/stackdriver_exporter.go:84 +0xa7
main.main()
	/go/src/github.com/frodenas/stackdriver_exporter/stackdriver_exporter.go:125 +0x24c

The problem was in using googleClient before checking if it's creation succeeded.

@frodenas frodenas merged commit 7028a8d into prometheus-community:master Nov 23, 2018
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.

2 participants