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

panic: runtime error: invalid memory address or nil pointer dereference #132

Open
Bodenhaltung opened this issue Mar 3, 2021 · 6 comments

Comments

@Bodenhaltung
Copy link

Bodenhaltung commented Mar 3, 2021

Hi,

on my vm the exporter crashed if i curl the metrics, i get a segfault:

./mongodb_exporter-linux-amd64 -mongodb.uri "mongodb://user:password@127.0.0.1:27017/database?replicaSet=rs0&authSource=admin"
Listening on :9001 (scheme=HTTP, secured=no, clientValidation=no)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x508228]

goroutine 22 [running]:
panic(0x73d340, 0xc42000e090)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/dcu/mongodb_exporter/collector.(*PreloadStats).Export(0x0, 0xc420052240)
        /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:363 +0x38
github.com/dcu/mongodb_exporter/collector.(*ReplStats).Export(0xc42020ecc0, 0xc420052240)
        /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:352 +0x90
github.com/dcu/mongodb_exporter/collector.(*MetricsStats).Export(0xc42020bb80, 0xc420052240)
        /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/metrics.go:435 +0x4c7
github.com/dcu/mongodb_exporter/collector.(*ServerStatus).Export(0xc42008f9a0, 0xc420052240)
        /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/server_status.go:111 +0x1f9
github.com/dcu/mongodb_exporter/collector.(*MongodbCollector).collectServerStatus(0xc420048f50, 0xc4200f8680, 0xc420052240, 0x7235e0)
        /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/mongodb_collector.go:85 +0xe3
github.com/dcu/mongodb_exporter/collector.(*MongodbCollector).Collect(0xc420048f50, 0xc420052240)
        /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/collector/mongodb_collector.go:64 +0x2d4
github.com/dcu/mongodb_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func2(0xc420054630, 0xc420052240, 0x928900, 0xc420048f50)
        /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:433 +0x63
created by github.com/dcu/mongodb_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Gather
        /Users/dc/code/go/src/github.com/dcu/mongodb_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:434 +0x326
@tcurdt
Copy link

tcurdt commented Apr 6, 2021

@Bodenhaltung did you manage to work around this? I got the same problem.

@saiakhil46
Copy link

saiakhil46 commented Apr 9, 2021

Facing same issue when I curl /metrics path
@dcu can you fix the issue, Thanks in advance

@tcurdt
Copy link

tcurdt commented Apr 9, 2021

I didn't find a work around and switched to https://github.com/percona/mongodb_exporter

@saiakhil46
Copy link

saiakhil46 commented Apr 9, 2021

@tcurdt Thanks, can you share supported grafana dashboard link.

@tcurdt
Copy link

tcurdt commented Apr 9, 2021

@tcurdt Thanks, can you share supported grafana dashboard link.

Not yet. Sorry.
Probably worth getting in touch with people from the percona project if you don't want to create it yourself.

@hloeung
Copy link

hloeung commented Sep 12, 2022

Looks like it might be similar to #127 with the PR #128

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

No branches or pull requests

4 participants