glanceapp/glance · warning

getting memory info: %v

Error message

getting memory info: %v

What it means

Non-fatal: mem.VirtualMemory() failed, so TotalMB/UsedMB/UsedPercent stay unset and the memory section of server-stats shows as unavailable; recorded via addErr and collection continues (swap is attempted separately).

Source

Thrown at pkg/sysinfo/sysinfo.go:188

			} else {
				info.CPU.Load1Percent = uint8(math.Min((loadAvg.Load1/float64(coreCount))*100, 100))
				info.CPU.Load15Percent = uint8(math.Min((loadAvg.Load15/float64(coreCount))*100, 100))
			}
		} else {
			addErr(fmt.Errorf("getting load avg: %v", err))
		}
	} else {
		addErr(fmt.Errorf("getting core count: %v", err))
	}

	memory, err := mem.VirtualMemory()
	if err == nil {
		info.Memory.IsAvailable = true
		info.Memory.TotalMB = memory.Total / 1024 / 1024
		info.Memory.UsedMB = memory.Used / 1024 / 1024
		info.Memory.UsedPercent = uint8(math.Min(memory.UsedPercent, 100))
	} else {
		addErr(fmt.Errorf("getting memory info: %v", err))
	}

	swapMemory, err := mem.SwapMemory()
	if err == nil {
		info.Memory.SwapIsAvailable = true
		info.Memory.SwapTotalMB = swapMemory.Total / 1024 / 1024
		info.Memory.SwapUsedMB = swapMemory.Used / 1024 / 1024
		info.Memory.SwapUsedPercent = uint8(math.Min(swapMemory.UsedPercent, 100))
	} else {
		addErr(fmt.Errorf("getting swap memory info: %v", err))
	}

	// currently disabled on Windows because it requires elevated privilidges, otherwise
	// keeps returning a single sensor with key "ACPI\\ThermalZone\\TZ00_0" which
	// doesn't seem to be the CPU sensor or correspond to anything useful when
	// compared against the temperatures Libre Hardware Monitor reports.
	// Also disabled on the bsd's because it's not implemented by go-psutil for them
	if runtime.GOOS != "windows" && runtime.GOOS != "openbsd" && runtime.GOOS != "netbsd" && runtime.GOOS != "freebsd" {

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Confirm /proc/meminfo is mounted and readable from the Glance process
  2. Adjust container security options (seccomp/apparmor) or mounts that block /proc
  3. If memory stats are simply unavailable in the environment, suppress the memory panel rather than chasing the error

Example fix

# docker run
# before
docker run -v ./glance.yml:/app/config/glance.yml glance

# after (ensure proc is available)
docker run -v ./glance.yml:/app/config/glance.yml --pid=host glance
Defensive patterns

Strategy: fallback

Type guard

func isMemoryErr(err error) bool {
	return err != nil && strings.Contains(err.Error(), "getting memory info")
}

Try / catch

info, err := sysinfo.Get()
if isMemoryErr(err) {
    // hide the memory panel; other stats remain valid
    renderServerStats(info, hideMemory=true)
}

Prevention

When it happens

Trigger: Reading memory stats fails: /proc/meminfo missing or unreadable on Linux, hoststats API denied on macOS, or WMI/perf-counter failure on Windows.

Common situations: Containers with /proc masked or not mounted; minimal base images; systems where the gopsutil backend syscall is denied by seccomp.

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/c59efaefcfdbf194. Report an issue: GitHub.