Skip to content

panic in process.ProcessesWithContext on freebsd #1898

Description

@sni

Describe the bug
I updated from v4.25.6 to v4.25.7 and now process.ProcessesWithContext panics on FreeBSD.

To Reproduce

process.ProcessesWithContext(context.TODO())

Expected behavior
It should not panic.

Environment (please complete the following information):

  • FreeBSD: freebsd-14.3 with golang 1.23.10

Additional context
i think the issue has been introduced here:

There have not been that many changes since the last 2 versions.

the panic log:

2025-08-11T12:16:14.9000734Z panic: reflect: call of reflect.Value.Field on int32 Value [recovered]
2025-08-11T12:16:14.9001407Z 	panic: reflect: call of reflect.Value.Field on int32 Value
2025-08-11T12:16:14.9001754Z 
2025-08-11T12:16:14.9001863Z goroutine 213 [running]:
2025-08-11T12:16:14.9002223Z testing.tRunner.func1.2({0xb8a560, 0x86c11a360})
2025-08-11T12:16:14.9002795Z 	/usr/local/go/src/testing/testing.go:1632 +0x230
2025-08-11T12:16:14.9003571Z testing.tRunner.func1()
2025-08-11T12:16:14.9003982Z 	/usr/local/go/src/testing/testing.go:1635 +0x35e
2025-08-11T12:16:14.9004455Z panic({0xb8a560?, 0x86c11a360?})
2025-08-11T12:16:14.9004817Z 	/usr/local/go/src/runtime/panic.go:791 +0x132
2025-08-11T12:16:14.9005319Z reflect.Value.Field({0xb6c980?, 0x86c2a0728?, 0x86c2a0728?}, 0x126b2e0?)
2025-08-11T12:16:14.9005975Z 	/usr/local/go/src/reflect/value.go:1272 +0xcf
2025-08-11T12:16:14.9006868Z github.com/shirou/gopsutil/v4/internal/common.(*decoder).value(0x86c2a06b8, {0xc67860?, 0x86c2a0728?, 0x440?})
2025-08-11T12:16:14.9008233Z 	/root/go/pkg/mod/github.com/shirou/gopsutil/v4@v4.25.7/internal/common/binary.go:475 +0x8be
2025-08-11T12:16:14.9009317Z github.com/shirou/gopsutil/v4/internal/common.Read({0xda1080, 0x86c245680}, {0xda9eb0, 0x1269900}, {0xb58500, 0x86c2a0728})
2025-08-11T12:16:14.9010830Z 	/root/go/pkg/mod/github.com/shirou/gopsutil/v4@v4.25.7/internal/common/binary.go:221 +0x60b
2025-08-11T12:16:14.9011766Z github.com/shirou/gopsutil/v4/process.parseKinfoProc({_, _, _})
2025-08-11T12:16:14.9012569Z 	/root/go/pkg/mod/github.com/shirou/gopsutil/v4@v4.25.7/process/process_bsd.go:74 +0xdc
2025-08-11T12:16:14.9013557Z github.com/shirou/gopsutil/v4/process.ProcessesWithContext({0xda6a10, 0x86c214ee0})
2025-08-11T12:16:14.9014589Z 	/root/go/pkg/mod/github.com/shirou/gopsutil/v4@v4.25.7/process/process_freebsd.go:332 +0x176

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions