Bus Error: Prometheus, mmap, and a FUSE Mount That Says EIO When It Means "Hang On"

Prometheus had restarted 114 times in about five months. I knew this the way you know your car makes a noise: abstractly, and with a firm intention to deal with it later. Then Alertmanager turned out to have been dead for a month without telling anyone (which is, to be fair, the one thing Alertmanager can't tell you), and "later" arrived.

This is the story of the crash, the wrong explanation I believed for about a day, and the right one, which involves the Go scheduler interrupting itself. I did not see that coming.

The Symptom

unexpected fault address 0xfffd78421480
fatal error: fault
[signal SIGBUS: bus error code=0x2 addr=0xfffd78421480 pc=0x22a2c1c]

SIGBUS. Not a panic, not an OOM kill, not exit 137. A bus error is the kernel saying "you touched memory I promised you and I can't deliver it." For a Go program that isn't doing anything exotic, that means one thing: a memory-mapped file whose backing store let it down.

And Prometheus's backing store was this:

seaweedfs-seaweedfs-filer.seaweedfs.svc.cluster.local:8888:/buckets/pvc-53bb3131-...
    on /prometheus type fuse.seaweedfs

A FUSE mount. Over the network. To a filer on another Pi. See the FUSE Mount Massacre for my previous adventures in this genre. I am apparently a slow learner.

The Wrong Theory (Which Was Also True)

The SeaweedFS volume servers were being OOMKilled. A lot:

Between 132 and 288 restarts apiece across the four of them, six to sixteen kills a week each, against a 512Mi limit. Storage server dies, FUSE mount can't fetch a chunk, mmap'd page can't be filled, SIGBUS. It's a lovely causal chain. It explained Prometheus, it explained Loki's corrupted WAL (segments are not sequential, down since June, nobody noticed that either), and it explained Alertmanager's dead mount.

So I gave the volume servers 2Gi:

resources:
  requests: { cpu: 100m, memory: 512Mi }
  limits:   { cpu: 500m, memory: 2Gi }

Zero restarts since. Great. Fixed. Wrote it up in my head. Moved on.

Six hours later:

prometheus   restartCount: 115   lastState: Error, exitCode 2
             startedAt 15:01:40Z  finishedAt 21:01:28Z

Same SIGBUS. With all four volume servers up, healthy, and not having restarted. The OOM kills were real and worth fixing, but they were not the cause. They were a cause. There's a difference, and the difference is 115.

Reading the Stack Trace Like an Adult

I'd been skimming past the goroutine dump because it's 700 lines of hex. The top of the faulting goroutine:

github.com/prometheus/prometheus/tsdb/chunks.(*ChunkDiskMapper).Chunk(...)
	/app/tsdb/chunks/head_chunks.go:753 +0x38c
github.com/prometheus/prometheus/tsdb.(*memSeries).chunk(...)
	/app/tsdb/head_read.go:426 +0x9c
...
github.com/prometheus/prometheus/rules.(*RecordingRule).Eval(...)
	/app/rules/recording.go:82 +0x158

ChunkDiskMapper is the thing that mmaps the head chunk files in chunks_head/. A recording rule ran a query, the query read a chunk through the mapping, the kernel went to fault the page in, and the page didn't come.

It also died about 75 seconds after this:

compact.go:576  msg="write block" ... duration=11.54s
head.go:1355    msg="Head GC completed"
checkpoint.go:101 msg="Creating checkpoint" from_segment=1772 to_segment=1774
head.go:1317    msg="WAL checkpoint complete"

So my second theory was: compaction truncates or deletes a file that's still mapped, and reads past the new EOF get SIGBUS. That's a real way to get a bus error. It's also wrong here: Prometheus holds a lock, closes the mapping, and then removes the file. It deletes whole files rather than shrinking them. The compaction timing is a coincidence of load, not the mechanism.

The Right Theory

The mount pod on the same node had opinions. From seaweedfs-csi-driver-mount, one morning's worth:

E1201 09:01:27 reader_at.go:249 fetching chunk &{FileId:303,4c4898323c2d65 ...}: context canceled
E1201 09:01:27 filehandle_read.go:99 file handle read
    /buckets/pvc-53bb3131-.../chunks_head/000370: context canceled

540 of those in three hours, all on chunks_head/00037x. Context canceled. Not "connection refused", not "volume server unavailable". Canceled. Somebody asked for the read and then told the mount to forget it.

Here's the chain, as best I can assemble it:

  1. A Prometheus goroutine touches a page of an mmap'd file that isn't in the page cache. Page fault. The kernel issues a FUSE read and the thread blocks in the kernel waiting for weed mount to answer.
  2. The Go runtime's sysmon notices a goroutine has been on-CPU (it thinks) for more than 10ms and sends the thread SIGURG to preempt it. This is normal. Go does this all day.
  3. A signal arrived for a thread blocked in a FUSE request, so the kernel sends the FUSE daemon a FUSE_INTERRUPT.
  4. weed mount 4.25 cancels the read's context and replies EIO. On perfectly healthy data.
  5. filemap_fault gets an error filling the page and returns VM_FAULT_SIGBUS.
  6. Go's signal handler sees SIGBUS at an address it didn't expect and throws fatal error: fault.

Prometheus is, in effect, interrupting its own page faults, and the filesystem is reporting the interruption as a disk error.

SeaweedFS fixed exactly this in PR #12723, merged 18 November 2026 and released in 4.55: "answered signal-interrupted reads with EIO on healthy data", about 250 failures per 5 million reads. My mount:

$ kubectl -n seaweedfs exec seaweedfs-seaweedfs-csi-driver-mount-nzkb8 -- weed version
version 30GB 4.25  linux arm64

Note that the weed mount binary comes from the CSI driver image (chrislusf/seaweedfs-mount:v1.4.13), not from the SeaweedFS chart. I'd upgraded the chart to 4.20.0 and assumed that was the version of everything. It is not.

Caveat, because I should be honest about what I actually proved: the stack trace and the mount logs are mine and they're solid. Steps 2 through 5 are stitched together from the kernel source and that PR. Nobody has written "this is why Prometheus dies on SeaweedFS" anywhere I could find. The clean experiment would be running Prometheus with GODEBUG=asyncpreemptoff=1 and watching the crashes stop. I didn't run it. I just left.

What the Docs Say (I Had Not Read the Docs)

Non-POSIX compliant filesystems are not supported for Prometheus' local storage as unrecoverable corruptions may happen. NFS filesystems (including AWS's EFS) are not supported... It is strongly recommended to use a local filesystem for reliability.

And the Prometheus issue tracker is a graveyard of people who also didn't read that: JuiceFS (#15344), Azure Files (#10892), Ceph (#13560), GlusterFS (#8670, same ChunkDiskMapper.Chunk frame as mine). Every one of them has the identical SIGBUS code=0x2, and every one ends with a maintainer saying some version of "all bets are off when the storage is not reliable."

Fair.

The Fix: Leave

Upgrading the mount to 4.55 would probably reduce the crash rate and would leave me on a filesystem Prometheus explicitly doesn't support. So: local disk.

Except "local disk" on the Pi 5s means this:

/dev/mmcblk0p2 / ext4          58G, 57% used     <- the SD card
/dev/nvme0n1   /var/lib/longhorn xfs  931G, 8% used

The default local-path class writes to /opt/local-path-provisioner, which is the SD card. A TSDB that writes constantly, on an SD card. No. The NVMe is mounted at /var/lib/longhorn because Longhorn used to live there and I never renamed it, and it's where SeaweedFS keeps its volumes now. There's 850GB free on each one.

So, a third local-path provisioner, local-path-nvme, cloned from the USB one:

{
  "nodePathMap": [
    { "node": "DEFAULT_PATH_FOR_NON_LISTED_NODES", "paths": [] },
    { "node": "manderly", "paths": ["/var/lib/longhorn/local-path-provisioner"] },
    { "node": "norcross", "paths": ["/var/lib/longhorn/local-path-provisioner"] },
    { "node": "oakheart", "paths": ["/var/lib/longhorn/local-path-provisioner"] },
    { "node": "payne",    "paths": ["/var/lib/longhorn/local-path-provisioner"] }
  ]
}

Empty paths for everyone else, so a pod that lands on a Pi 4 fails to provision instead of cheerfully writing to whatever's there. reclaimPolicy: Retain, because the day before all this the Loki volume got deleted by a kubectl scale --replicas=0 meeting a whenScaled: Delete policy on a Delete StorageClass, and I'm done with storage classes that take the data with them.

The Part Where It Didn't Work

failed to provision volume with StorageClass "local-path-nvme": failed to create volume
pvc-8e5beccc-...: pods "helper-pod-create-pvc-8e5beccc-..." is forbidden: violates
PodSecurity "baseline:latest": hostPath volumes (volume "data")

My namespace.yaml sets pod-security.kubernetes.io/enforce: privileged. The namespace did not have that label. Why?

Because the upstream deploy/ manifest ships its own Namespace (local-path-storage), and the Flux Kustomization's targetNamespace helpfully renames it to mine. Now two Kustomizations own the same Namespace, and the one that applies last, the one without the labels, wins.

The fun part: local-path-usb-provisioner had the exact same bug and had been sitting there broken for over a year. It had just never been asked to provision anything. Schrödinger's StorageClass. Fixed both with a patch in the deploy Kustomization:

- patch: |-
    apiVersion: v1
    kind: Namespace
    metadata:
      name: local-path-storage
      labels:
        pod-security.kubernetes.io/enforce: privileged
        pod-security.kubernetes.io/audit: privileged
        pod-security.kubernetes.io/warn: privileged
  target:
    kind: Namespace

The Move

The awkward bit is that a StatefulSet's PVC name is fixed, so "change the storage class" really means "delete the PVC and make a new one with the same name." Which is exactly the kind of sentence that precedes data loss. So, in order, checking after each step:

# 1. The old volume survives no matter what happens next.
kubectl patch pv pvc-53bb3131-0453-4e71-899c-e8f154dbdf6b \
  -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'

# 2. Stop Helm from "helping", then stop Prometheus.
flux suspend helmrelease kube-prometheus-stack -n flux-system
kubectl -n monitoring patch prometheus monitoring-kube-prometheus-prometheus \
  --type merge -p '{"spec":{"replicas":0}}'

# 3. Delete the claim (PV goes Released, data stays), free the PV for re-use.
kubectl -n monitoring delete pvc prometheus-monitoring-kube-prometheus-prometheus-db-prometheus-monitoring-kube-prometheus-prometheus-0
kubectl patch pv pvc-53bb3131-... --type json -p '[{"op":"remove","path":"/spec/claimRef"}]'

Then three objects: a prom-old PVC with volumeName pointing at the retained SeaweedFS volume, a new PVC with the original name on local-path-nvme, and a busybox pod pinned to oakheart mounting both:

cp -a /old/. /new/ ; echo "cp exit: $?"
diff -rq /old /new ; echo "diff exit: $?"

Yes, I read 7.6GB back through the same FUSE mount that had been throwing EIO, which is why the diff is there. busybox isn't a Go program and doesn't preempt itself with signals, so the reads were fine:

cp exit: 0
old: files=132 kb=7914263
new: files=132 kb=7914596
diff exit: 0

Two and a half minutes to copy, two and a half to verify. Then push the gitops change (storageClassName: local-path-nvme plus a node affinity for the four Pi 5s), resume the HelmRelease, and scale back up. One more gotcha: Helm's three-way merge saw replicas: 1 in both the old and new manifests and so left my live replicas: 0 alone. I had to patch it back to 1 by hand.

/dev/nvme0n1 on /prometheus type xfs (rw,noatime,attr2,inode64,...)
msg="WAL segment loaded" segment=1807 maxSegment=1807
msg="TSDB started"
msg="Server is ready to receive web requests."

Twelve minutes of downtime, history intact back to the retention edge.

What I Don't Know Yet

Whether it worked. Prometheus went sixteen hours between its last two crashes, so "it's been up for an hour" proves nothing. Restart count is 0 on a fresh pod; ask me in a week.

Postscript: Loki Too, and the Driver

Same afternoon, since I was already holding the shovel.

Loki got the same eviction: Retain on the old PV, scale to zero (having checked whenScaled: Retain this time, thank you), copy, diff, new claim with the old name on local-path-nvme. 1,917 files, clean. It went to payne rather than oakheart, so one dead Pi doesn't take metrics and logs. The only wrinkle versus Prometheus: Loki's StatefulSet comes straight from the Helm chart, volumeClaimTemplates is immutable, so the empty StatefulSet had to be deleted before the upgrade could recreate it.

msg="WAL segment recovery finished" elapsed=1.188634397s errors=false

The CSI driver went from chart 0.2.19 to 0.2.48, which takes seaweedfs-mount from v1.4.13 to v1.4.41 and weed from 4.25 to 4.56. The rendered diff between the two charts was just image tags and fsGroupPolicy: File on the CSIDriver.

The mount DaemonSet is OnDelete, and entry 111 is a detailed record of what happens when you restart a mount pod under a live mount. So this time, in the order that doesn't hurt:

  1. Scale every consumer of a seaweedfs volume to zero: Gatus, Alertmanager, Tempo, all three NATS.
  2. Confirm nothing has a FUSE volume mounted.
  3. Bump the chart. Controller and node plugin roll on their own.
  4. Delete all thirteen mount pods. Nobody's home, so nobody gets transport endpoint is not connected.
  5. Scale everything back up.

About fifteen minutes of no NATS, no Alertmanager, no Tempo, no Gatus. Zero stale mounts, zero trips through the five-step recovery playbook. Tempo sulked in ContainerCreating for five minutes, which turned out to be an image pull on a node it had never run on before.

The old volumes are still there as prom-old and loki-old, Retained, in case the new ones turn out to be haunted.

Lessons, Such As They Are

  • A plausible root cause that fixes a real problem is the most dangerous kind, because you stop looking. The volume servers really were OOMing. It really did need fixing. It really wasn't the bug.
  • Read the stack trace. The answer to "which file?" was in the first four frames the whole time.
  • SIGBUS means mmap. mmap over a network filesystem means you've chosen violence.
  • The version of the chart is not the version of the thing in the pod next to it.
  • A StorageClass nobody has ever used is not a working StorageClass. It's a hypothesis.