Skip to content

Conversation

Tiger1218
Copy link

The pcidevice collector panics with a "nil pointer dereference" error
on some systems. This occurs when a PCI device lacks certain attributes
in sysfs, such as 'current_link_speed' or 'current_link_width'.

The collector's Update method attempted to dereference these pointers
without verifying if they were nil, leading to a crash.

This commit introduces checks to verify that the link speed and width
pointers are not nil before they are dereferenced. If an attribute is
missing for a device, its corresponding metric will now be reported as 0,
making the collector more robust and preventing node_exporter from
crashing.

Signed-off-by: Tiger1218 <tiger1218@foxmail.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.

1 participant