Skip to content

Comments

Fix crash if port_rcv_data contains "N/A (no PMA)"#187

Merged
pgier merged 1 commit intoprometheus:masterfrom
bdrung:fix-ib-crash
Jun 27, 2019
Merged

Fix crash if port_rcv_data contains "N/A (no PMA)"#187
pgier merged 1 commit intoprometheus:masterfrom
bdrung:fix-ib-crash

Conversation

@bdrung
Copy link
Contributor

@bdrung bdrung commented Jun 26, 2019

In case port_rcv_data contains N/A (no PMA), vp.PUInt64 returns nil which is assigned to counters.PortRcvData. Then the content of counters.PortRcvData cannot be multiplied by four. The program will fail with:

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

This issue was found by the tests in prometheus/node_exporter#1396

In case `port_rcv_data` contains `N/A (no PMA)`, `vp.PUInt64` returns
`nil` which is assigned to `counters.PortRcvData`. Then the content of
`counters.PortRcvData` cannot be multiplied by four. The program will
fail with:

```
panic: runtime error: invalid memory address or nil pointer dereference
```

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
@discordianfish
Copy link
Member

Wondering if we could handle that better in the value parser but possibly not, so LGTM either way.

@bdrung
Copy link
Contributor Author

bdrung commented Jun 26, 2019

Alternatively the value parser could accept a function that it applies on the value before returning it.

@pgier pgier merged commit 39e1aff into prometheus:master Jun 27, 2019
bdrung added a commit to bdrung/node_exporter that referenced this pull request Jul 1, 2019
procfs v0.0.4-0.20190627154503-39e1aff1547e is a requirement for
prometheus#1357 (because procfs
v0.0.3 contained bug prometheus/procfs#187)

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
SuperQ pushed a commit to prometheus/node_exporter that referenced this pull request Jul 1, 2019
procfs v0.0.4-0.20190627154503-39e1aff1547e is a requirement for
#1357 (because procfs
v0.0.3 contained bug prometheus/procfs#187)

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
@bdrung bdrung deleted the fix-ib-crash branch September 3, 2019 10:46
bobrik pushed a commit to bobrik/procfs that referenced this pull request Jan 14, 2023
Fix build.rs to allow cross-compilation
oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
procfs v0.0.4-0.20190627154503-39e1aff1547e is a requirement for
prometheus#1357 (because procfs
v0.0.3 contained bug prometheus/procfs#187)

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
oblitorum pushed a commit to shatteredsilicon/node_exporter that referenced this pull request Apr 9, 2024
procfs v0.0.4-0.20190627154503-39e1aff1547e is a requirement for
prometheus#1357 (because procfs
v0.0.3 contained bug prometheus/procfs#187)

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
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.

3 participants