Automattic / Automattic/hostmgr
VM start command race condition
- Dominant language
- Swift
- Stars
- 12
- Forks
- 3
- Avg merge
- 4h 50m
- Merged PRs (30d)
- 4
Description
When a VM is started with the `hostmgr start` command, a race condition exists where:
1. The VM is requested to be started
2. The server (`hostmgr-helper`) returns that the VM has started
3. The client (`hostmgr`) then [grabs the IP](https://github.com/Automattic/hostmgr/blob/82fbaeb6b5d47c89a24fc7e3e80736e05876c6eb/Sources/libhostmgr/Platforms/VMManager.swift#L112) (if told to) of the new VM and [confirms that SSH is available](https://github.com/Automattic/hostmgr/blob/82fbaeb6b5d47c89a24fc7e3e80736e05876c6eb/Sources/libhostmgr/Platforms/VMManager.swift#L113)
It's possible for the VM to be removed between steps 2 and 3 if an outside call is made to `hostmgr vm stop`. An improvement could be for the second step to return this information upon creation synchronously and remove step 3.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in Sources/libhostmgr/Platforms/VMManager.swift at the IP lookup and SSH confirmation around lines 112–113, then trace the hostmgr start response from hostmgr-helper and the hostmgr vm stop path. Reproduce the timing window if possible and define done as preventing a VM from disappearing between the start response and follow-up checks, with the creation response carrying the needed information synchronously.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, swift
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100