Skip to content

[inputs.diskio] Panic in gopsutil #17508

@sergeymakinen

Description

@sergeymakinen

Relevant telegraf.conf

[[inputs.diskio]]
  devices = ["ada?", "da?"]

Logs from Telegraf

2025-08-23T11:07:30Z E! FATAL: [inputs.diskio] panicked: reflect: call of reflect.Value.Field on uint32 Value, Stack:
goroutine 124 [running]:
github.com/influxdata/telegraf/agent.panicRecover(0x87cc392c0)
	github.com/influxdata/telegraf/agent/agent.go:1202 +0x6d
panic({0xcaa020?, 0x87d9081c8?})
	runtime/panic.go:792 +0x132
reflect.Value.Field({0x8f0160?, 0x87cdc3608?, 0x87cdc3608?}, 0x32d2b00?)
	reflect/value.go:1272 +0xcf
github.com/shirou/gopsutil/v4/internal/common.(*decoder).value(0x87cdc3598, {0x1f5ee60?, 0x87cdc3608?, 0x120?})
	github.com/shirou/gopsutil/v4@v4.25.7/internal/common/binary.go:475 +0x8be
github.com/shirou/gopsutil/v4/internal/common.Read({0x314eae0, 0x87d96ed50}, {0x3232af0, 0x11fd91a0}, {0x680600, 0x87cdc3608})
	github.com/shirou/gopsutil/v4@v4.25.7/internal/common/binary.go:221 +0x8c5
github.com/shirou/gopsutil/v4/disk.parsedevstat({_, _, _})
	github.com/shirou/gopsutil/v4@v4.25.7/disk/disk_freebsd.go:158 +0xfc
github.com/shirou/gopsutil/v4/disk.IOCountersWithContext({0x32012c0, 0x11fd91a0}, {0x0, 0x0, 0x0?})
	github.com/shirou/gopsutil/v4@v4.25.7/disk/disk_freebsd.go:119 +0x1a7
github.com/shirou/gopsutil/v4/disk.IOCounters(...)
	github.com/shirou/gopsutil/v4@v4.25.7/disk/disk.go:84
github.com/influxdata/telegraf/plugins/common/psutil.(*SystemPS).DiskIO(0x87c557300?, {0x0?, 0x0?, 0x0?})
	github.com/influxdata/telegraf/plugins/common/psutil/ps.go:195 +0x30
github.com/influxdata/telegraf/plugins/inputs/diskio.(*DiskIO).Gather(0x87cc39200, {0x3247420, 0x87cf1c820})
	github.com/influxdata/telegraf/plugins/inputs/diskio/diskio.go:73 +0x6d
github.com/influxdata/telegraf/models.(*RunningInput).Gather(0x87cc392c0, {0x3247420, 0x87cf1c820})
	github.com/influxdata/telegraf/models/running_input.go:260 +0x251
github.com/influxdata/telegraf/agent.(*Agent).gatherOnce.func1()
	github.com/influxdata/telegraf/agent/agent.go:590 +0x58
created by github.com/influxdata/telegraf/agent.(*Agent).gatherOnce in goroutine 14
	github.com/influxdata/telegraf/agent/agent.go:588 +0xf7

goroutine 1 [sync.WaitGroup.Wait]:
sync.runtime_SemacquireWaitGroup(0x87d927680?)
	runtime/sema.go:110 +0x25
sync.(*WaitGroup).Wait(0x87d906010?)
	sync/

System info

Telegraf 1.35.4, FreeBSD 14.2

Docker

No response

Steps to reproduce

  1. Try to run Telegraf with the config above on FreeBSD

Expected behavior

No panics

Actual behavior

Telegraf panics on start

Additional info

It looks like shirou/gopsutil#1898 is probably related to this. Also, Telegraf 1.35.3 doesn't have this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions