Skip to content

error out when run_vminitd.sock path length is too long#89

Merged
dmcgowan merged 1 commit intocontainerd:mainfrom
akerouanton:unix-path-limit
Feb 6, 2026
Merged

error out when run_vminitd.sock path length is too long#89
dmcgowan merged 1 commit intocontainerd:mainfrom
akerouanton:unix-path-limit

Conversation

@akerouanton
Copy link
Member

On macOS, UNIX socket path is limited to 104 characters (including \0). To circumvent this limitation, vmInstance.Start() tries to compute the relative path to the run_vminitd.sock. However, if the bundle path points to a symlinked directory, this relative path may contain many double-dots and the full path, exceeding the limit. This is the case if containerd state dir is in /tmp (which is symlinked to /private/tmp on macOS).

In that case, nothing fails explicitly. It appears as if the VM failed to start, whereas the log show that vminitd executed successfully. The only error logged is: Timeout while waiting for VM to start.

Detect if the socket path is too long before trying to start the VM, and return an explicit error.

Copilot AI review requested due to automatic review settings January 28, 2026 15:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a macOS-specific issue where UNIX socket paths exceeding 104 characters cause VM startup failures without clear error messages. The change adds explicit validation to detect overly long socket paths before attempting to start the VM, providing users with a clear error message instead of a generic timeout.

Changes:

  • Added pre-emptive validation for socket path length on macOS
  • Added explanatory comments about the macOS socket path limitation and failure symptoms

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dmcgowan
Copy link
Member

LGTM on this change, did something else change to cause the calculation to differ or use a different cwd?

@dmcgowan
Copy link
Member

We should probably just ditch the state directory in the vm instance and use cwd. If we need to support multiple VMs in the future, we can add an identifier which just gets added in the .sock file name

UNIX socket path is limited to 104 characters (including \0) on macOS
and 108 on Linux and Windows.

To circumvent this limitation, vmInstance.Start() tries to compute the
relative path to the run_vminitd.sock. However, if the bundle path
points to a symlinked directory, this relative path may contain many
double-dots and the full path, exceeding the limit. This is the case if
containerd state dir is in /tmp (which is symlinked to /private/tmp on
macOS).

In that case, nothing fails explicitly. It appears as if the VM failed
to start, whereas the log show that vminitd executed successfully. The
only error logged is: Timeout while waiting for VM to start.

Detect if the socket path is too long before trying to start the VM, and
return an explicit error.

Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
Copilot AI review requested due to automatic review settings February 6, 2026 12:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@akerouanton
Copy link
Member Author

LGTM on this change, did something else change to cause the calculation to differ or use a different cwd?

No it was just caused by running some integration tests in /tmp on mac. Since /tmp is a symlink to some /private/tmp folder, the relative path was looking like ../private/tmp, so it was exceeding the path limit.

@dmcgowan dmcgowan merged commit 7b94bbe into containerd:main Feb 6, 2026
3 checks passed
@akerouanton akerouanton deleted the unix-path-limit branch February 6, 2026 18:36
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.

3 participants