-
-
Notifications
You must be signed in to change notification settings - Fork 543
Description
Description
I encountered a process leak issue when running Colima with a custom LaunchAgent configuration. After investigating, I found the cause and wanted to share my findings in case it helps others.
Environment
- macOS: Darwin 25.2.0 (Apple Silicon)
- Colima version: (installed via Homebrew)
- VM Type: vz
The Problem
I had created a custom LaunchAgent plist at ~/Library/LaunchAgents/com.github.abiosoft.colima.plist with the following configuration:
<key>KeepAlive</key>
<true/>When Colima failed to start (due to an unrelated disk attachment error), the KeepAlive setting caused launchd to continuously restart the process. However, each restart attempt spawned new limactl processes (especially limactl usernet) that were not properly cleaned up when the parent process exited.
Over time, this resulted in 3,800+ orphaned limactl processes accumulating on my system, which caused:
- Extremely high system load (Load Average: 200-600)
kernel_taskconsuming significant CPU managing these processes- Overall system sluggishness
Error Logs
From /tmp/colima.err, the startup was failing repeatedly:
time="2026-02-06T11:09:36+08:00" level=fatal msg="error starting vm: error at 'starting': exit status 1"
time="2026-02-06T11:09:47+08:00" level=fatal msg="error starting vm: error at 'starting': exit status 1`
... (repeated ~50 times in 10 minutes)
From ~/.colima/_lima/colima/ha.stderr.log:
{"level":"fatal","msg":"failed to run attach disk \"colima\", in use by instance \"colima\"","time":"2026-02-06T11:19:54+08:00"}
Resolution
I noticed that the official Homebrew service configuration uses a different KeepAlive setting:
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<true/>
</dict>After updating my LaunchAgent to use SuccessfulExit instead of a plain <true/>, and cleaning up the orphaned processes, the issue was resolved.
I also found that using brew services start colima with the official Homebrew plist works well and avoids this problem entirely.
Investigation Notes
- The issue appears specific to using
KeepAlive: true(boolean) versusKeepAlive.SuccessfulExit: true(dictionary) - When startup fails repeatedly, the boolean form causes immediate restart without proper cleanup
- The
SuccessfulExitform only restarts on clean exits, preventing the restart loop - It might be helpful to document this behavior for users creating custom LaunchAgents
I was able to resolve this on my end, but wanted to report it in case it's helpful for the project or other users.