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 during url parsing #948

Closed
breadly7 opened this issue Nov 6, 2024 · 0 comments · Fixed by #949
Closed

nil pointer during url parsing #948

breadly7 opened this issue Nov 6, 2024 · 0 comments · Fixed by #949

Comments

@breadly7
Copy link

breadly7 commented Nov 6, 2024

Describe the bug
When starting the exporter (from version 0.42.0 on) and providing a password that contains special characters the exporter crashes during the call here:
https://github.com/percona/mongodb_exporter/blob/v0.42.0/main.go#L147

Using an older version (e.g. 0.41.0) with the same arguments results in an error that logs the mongodb connection string.

Are passwords with special characters even supported?

To Reproduce

($PASSWORDS contains special characters, in my tests I used ? and !)

  1. Start the exporter with the following arguments: mongodb_exporter --mongodb.uri "mongodb://localhost:27017/?authSource=admin" --mongodb.user $USER --mongodb.password $PASSWORD
  2. The exporter crashes pretty much immediately

Expected behavior
I expect it not to crash.

Logs
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xcea293]
goroutine 1 [running]:
net/url.(*URL).Port(...)
/opt/bitnami/go/src/net/url/url.go:1196
main.buildExporter({{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc0006026f0, 0x1, ...}, ...}, ...)
/bitnami/blacksmith-sandox/mongodb-exporter-0.42.0/src/github.com/percona/mongodb_exporter/main.go:147 +0xd3
main.buildServers({{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xc0006026f0, 0x1, ...}, ...}, ...)
/bitnami/blacksmith-sandox/mongodb-exporter-0.42.0/src/github.com/percona/mongodb_exporter/main.go:197 +0x105
main.main()
/bitnami/blacksmith-sandox/mongodb-exporter-0.42.0/src/github.com/percona/mongodb_exporter/main.go:138 +0x725

Environment

  • environment: k8s
  • exporter version: 0.42.0

Additional context

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