Skip to content

feat: tell the user when the Podman Machine runs out of memory and offer more - #2249

Merged
geodro merged 5 commits into
mainfrom
feat/vm-memory-pressure
Oct 21, 2026
Merged

geodro merged 5 commits into
mainfrom
feat/vm-memory-pressure

Conversation

@geodro

@geodro geodro commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

When the Podman Machine VM on macOS runs out of memory, its kernel kills whatever is using the most, usually MySQL or a PHP worker. Commands that need them then hang or fail, and nothing in lerd points at the cause. Switching a site with Horizon and scheduler workers to the container runtime was enough to do it on a 4 GB VM: fourteen PHP processes at about 140 MB each next to MySQL, and the kernel killed mysqld six times and the VM's own systemd twice within twenty minutes.

lerd now reads the VM's serial console log, which podman keeps on the host, and counts the out-of-memory kills since the VM last booted. Reading it costs nothing inside the VM, so the dashboard checks it once a minute.

While there have been kills, the dashboard shows a banner saying how many and what was killed, with a button that restarts the VM with 2 GB more, never past half of the Mac's memory, after a confirmation. The restart stops the VM, sets its memory and runs the normal start, so every container comes back with its port forwards, and its progress shows in the banner. When the Mac has nothing more to give, the banner says so and suggests stopping unused sites or workers instead. Dismissing it hides it until the next kill.

The same finding is available from the terminal as lerd machine memory, which takes a size in GB to do the restart, and lerd doctor reports it under Containers & Images. A size set this way is kept, since lerd start only ever raises the VM to its default and never lowers it. Linux has no VM, so none of this shows there.

image

…fer more

When the macOS VM runs out of memory its kernel kills whatever uses the most, usually MySQL or a PHP worker, and commands that need them hang or fail with nothing pointing at the cause. lerd now reads the VM's serial console log on the host and counts those kills since the last boot, so the check costs nothing inside the VM.

The dashboard shows a banner while the VM has had kills, naming what was killed, with a button that restarts the VM with 2 GB more, never past half the Mac's memory, and then runs the normal start so every container comes back. `lerd machine memory` reports the same and takes a size in GB to do the restart from the terminal, and `lerd doctor` flags it under Containers & Images. A size set this way is kept, since lerd start only ever raises the VM to its default.
@geodro
geodro requested a review from a team as a code owner October 19, 2026 20:17
@greptile-apps

greptile-apps Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The latest changes appear safe to merge, with one non-blocking warning-display issue remaining from the previous review.

Findings

  1. P2 New memory warnings stay hidden ▶
Fix with agent prompt
### Issue 1
internal/ui/web/src/components/MachineMemoryBanner.svelte:undefined-42
`dismissedAt` lasts for the page's lifetime, but the kill count resets each boot. If the user dismisses three kills, restarts the VM, and then gets one new kill, `1 > 3` stays false. The dashboard hides the new warning until the count exceeds the old one. Reset dismissal when the boot changes instead of comparing counts across boots.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR adds memory warnings and a guided VM resize from the dashboard and CLI.

  • lerd reports which processes the Podman Machine killed for lack of memory.
  • You can restart the Podman Machine with more memory from the terminal.
  • The dashboard shows memory kills and offers a guided VM restart.

Reviews (5) · Last reviewed commit: "fix: say when the VM memory check could ..." · Reviewed by Greptile

Comment thread internal/ui/machine_memory.go
Comment thread internal/cli/machine_memory_darwin.go Outdated
}
</script>

{#if kills.length > dismissedAt || resizing}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 New memory warnings stay hidden

dismissedAt lasts for the page's lifetime, but the kill count resets each boot. If the user dismisses three kills, restarts the VM, and then gets one new kill, 1 > 3 stays false. The dashboard hides the new warning until the count exceeds the old one. Reset dismissal when the boot changes instead of comparing counts across boots.

Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/ui/web/src/components/MachineMemoryBanner.svelte
Line: 42

Comment:
**New memory warnings stay hidden**

`dismissedAt` lasts for the page's lifetime, but the kill count resets each boot. If the user dismisses three kills, restarts the VM, and then gets one new kill, `1 > 3` stays false. The dashboard hides the new warning until the count exceeds the old one. Reset dismissal when the boot changes instead of comparing counts across boots.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 27b55f4, a count lower than the dismissed one means a new boot and resets the dismissal.

Comment thread internal/ui/web/src/components/MachineMemoryBanner.svelte Outdated
Comment thread internal/ui/web/src/components/MachineMemoryBanner.svelte Outdated
Comment thread internal/cli/machine_memory_darwin.go Outdated
A remote session without full access could post to the resize endpoint and stop every container, so the restart now needs the same host-action authority as the other host operations, while the finding itself stays readable. When setting the memory fails after the VM is already stopped, lerd still runs the start so the sites come back on the old size, and reports both errors.

The banner now shows why a restart failed, keeps the button away while another start or stop is running, brings itself back after a reboot even when the new count is lower than the one dismissed, and no longer tells the user the Mac is out of memory when the VM's size simply could not be read.
Comment thread internal/cli/machine_memory_darwin.go Outdated
Comment thread internal/cli/machine_memory_darwin.go Outdated
…e lookup

A missing console log or a failed machine list used to come back as an empty record, so lerd doctor and lerd machine memory told the user the VM had not run out of memory when neither could check. The check now returns an error, doctor shows it as a warning, the command fails with it, and the dashboard endpoint answers 500 so the banner keeps what it had.

The machine lookup also goes through the bounded machine query now, so a VM wedged after sleep cannot leave a hung podman machine list behind every minute's poll.
@geodro
geodro merged commit 9fd587c into main Oct 21, 2026
12 checks passed
@geodro
geodro deleted the feat/vm-memory-pressure branch October 21, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant