Skip to content

Commit 70166be

Browse files
class_infiniband: continue on syscall EINVAL (#705)
#704 In some very bleeding-edge configurations, syscalls against some IB counters will return `invalid argument`. This bubbles back to callers (e.g. node_exporter) in a very bad way -- e.g. all IB metrics collection failing when a single or group of IB ports returns this. Suspect this has always been an error case and possible to experience, but it's the first time we're seeing it in a very new hardware deployment. Signed-off-by: Michael Fuller <[email protected]>
1 parent f61a330 commit 70166be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sysfs/class_infiniband.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"path/filepath"
2424
"strconv"
2525
"strings"
26+
"syscall"
2627

2728
"github.com/prometheus/procfs/internal/util"
2829
)
@@ -319,7 +320,7 @@ func parseInfiniBandCounters(portPath string) (*InfiniBandCounters, error) {
319320
name := filepath.Join(path, f.Name())
320321
value, err := util.SysReadFile(name)
321322
if err != nil {
322-
if os.IsNotExist(err) || os.IsPermission(err) || err.Error() == "operation not supported" || errors.Is(err, os.ErrInvalid) {
323+
if os.IsNotExist(err) || os.IsPermission(err) || err.Error() == "operation not supported" || errors.Is(err, os.ErrInvalid) || errors.Is(err, syscall.EINVAL) {
323324
continue
324325
}
325326
return nil, fmt.Errorf("failed to read file %q: %w", name, err)

0 commit comments

Comments
 (0)