Skip to content

filesystemCollector crash with non-utf8 mount point #3662

Description

@PierreF

node_export crash when a filesystem is mounted on a non-utf8 path. This is possible on Linux, because on Linux IIRC path are binary (with most of the time being UTF-8). But if someone using different encoding for paths, you could ends with non-utf8 paths which result in a node_exporter crash:

panic: label value "/mnt/cass\xe9" is not valid UTF-8

goroutine 35 [running]:
github.com/prometheus/client_golang/prometheus.MustNewConstMetric(...)
        /go/pkg/mod/github.com/prometheus/client_golang@v1.23.2/prometheus/value.go:129
github.com/prometheus/node_exporter/collector.(*filesystemCollector).Update(0x400019e9a0, 0x40002463f0)
        /app/collector/filesystem_common.go:198 +0x704
github.com/prometheus/node_exporter/collector.execute({0x7f8189, 0xa}, {0x92ebe0, 0x400019e9a0}, 0x40002463f0, 0x4000174f50)
        /app/collector/collector.go:160 +0x60
github.com/prometheus/node_exporter/collector.NodeCollector.Collect.func1({0x7f8189?, 0x0?}, {0x92ebe0?, 0x400019e9a0?})
        /app/collector/collector.go:151 +0x34
created by github.com/prometheus/node_exporter/collector.NodeCollector.Collect in goroutine 33
        /app/collector/collector.go:150 +0xa4

Reproduce

On Linux (tested on a Ubuntu 24.04 arm64 VM, but shouldn't matter):

  • Mount a filesystem on a utf-8 invalid path (this might required bash as shell, I'm unsure if $'\xe9' is portable)
fallocate -l 32m /root/disk.dd
mkfs -t ext2 /root/disk.dd
mount --mkdir /root/disk.dd /mnt/cass$'\xe9'
  • Run node_exporter
./node_exporter
  • Do a collection
curl http://localhost:9100/metrics

To cleanup:

umount /mnt/cass$'\xe9'
rm /root/disk.dd

Version information

# ./node_exporter --version
node_exporter, version 1.10.2 (branch: HEAD, revision: 654f19dee6a0c41de78a8d6d870e8c742cdb43b9)
  build user:       root@b29b4019149a
  build date:       20251025-20:06:08
  go version:       go1.25.3
  platform:         linux/arm64
  tags:             unknown

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:        24.04
Codename:       noble

# uname -a
Linux ubuntu2404 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec  5 13:32:09 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions