Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Host Compute Service bug breaks docker (and other) sandboxes bigger than 20G on Windows 1903 #708

Closed
mitchcapper opened this issue Oct 3, 2019 · 1 comment · Fixed by moby/moby#40250 or docker/cli#2242

Comments

@mitchcapper
Copy link

mitchcapper commented Oct 3, 2019

This is being filed here as it is one of two wrappers microsoft talks about for it at: https://docs.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/containerd

This one clearly is the primary one being used as well. If there is somewhere better for this bug then happy to file there.

I am not sure if fixing this bug will require a platform update (or if it is already fixed in an insider build). A great temporary work around would be if there was somewhere (registry or otherwise) where the default sandbox layer size could be changed from 20G to something else by the end user who encounters this issue.

This is not a docker problem (can be reproduced outside of docker), this is a Windows Host Compute Service bug starting in 1903. It is a pretty major blocker as it prevents(for example) all docker windows containers bigger than 20G (new or existing I believe, so users upgrading will then be broken).

It can be reproduced with docker as illustrated in bugs(will be referenced as 0x57 when its this):

by setting the storage option size=20481M or bigger either on docker daemon.json OR in the run command with docker run --storage-opt size=20481M

Docker will then fail with:

hcsshim::PrepareLayer - failed failed in Win32: The parameter is incorrect. (0x57)

Or it can be recreated using Microsoft.Windows.ComputeVirtualization library which essentially does what hcsshim does and sits on top of the vmcompute.dll dll.

While the call to ExpandSandboxSize with a size greater than 20480M succeeds (and the vhdx can be checked to reflect the new larger size) the further call to PrepareLayer will fail. The MountSandbox command from the ComputeVirtualization lib does that call after calling ActivateLayer.

To replicate in short hand:

ContainerStorage.CreateSandbox(child_path, layers);
ContainerStorage.ExpandSandboxSize(child_path, 20480 * 1024 * 1024L);
ContainerStorage.MountSandbox(child_path, layers);

This will succeed when set to 20480 and fail at 20481. I have attached a sample application sandbox.zip with a generic blank base layer that can be used to test this(use any base layer you want though). The app must be run as Admin as it is the only one with permissions to run some of the host compute commands. Extract sandbox.zip to c:\temp\sandbox (or update the base dir you extracted to in the MainWindow.xaml.cs). Change MainWindow.xaml.cs between 20480 and 20481 to see it work or fail.

There is very little (none?) official documentation around vmcompute.dll or even Microsoft.Windows.ComputeVirtualization but looking at the Microsoft.Windows.ComputeVirtualization prepareLayer call it seems very generic without any special or odd flags I can find.

@jterry75
Copy link
Contributor

Closing out since #718 provide a workaround for now while we wait for the platform fix to be sent via WU.

thaJeztah added a commit to thaJeztah/cli that referenced this issue Jan 7, 2020
full diff: https://2226e083fc390003ae5aa8325c3c92789afa0e7a...b3f49c06ffaeef24d09c6c08ec8ec8425a0303e2

includes:

- microsoft/hcsshim#718 wclayer: Work around Windows bug when expanding sandbox size
    - fixes microsoft/hcsshim#708 Windows Host Compute Service bug breaks docker (and other) sandboxes bigger than 20G on Windows 1903
    - fixes microsoft/hcsshim#624The hcsshim on Windows 10 1903 always fails to build Docker image
    - fixes/addresses docker/for-win#3884 An error occurred while attempting to build Docker image (especially this comment and the next comments after: docker/for-win#3884 (comment))
    - fixes/addresses docker/for-win#4100 Windows 1903 fails when storage-opt used
    - fixes moby/moby#36831 hcsshim::PrepareLayer failed in Win32: The parameter is incorrect (moby/moby#36831 (comment))
    - fixes Stannieman/audacity-with-asio-builder#5 Docker won't build container
    - fixes MicrosoftDocs/visualstudio-docs#3523 Error when running build with storage-opts set
    - fixes moby/moby#39524 Docker build windows 19.03 --storage-opt size>20G

Note that this is a temporary workaround for a bug in the platform, and will be reverted once that is addressed:

- microsoft/hcsshim#721 Revert 718 when Windows 19H1 has expand sandbox fix

Signed-off-by: Sebastiaan van Stijn <[email protected]>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this issue Jan 9, 2020
full diff: https://2226e083fc390003ae5aa8325c3c92789afa0e7a...b3f49c06ffaeef24d09c6c08ec8ec8425a0303e2

includes:

- microsoft/hcsshim#718 wclayer: Work around Windows bug when expanding sandbox size
    - fixes microsoft/hcsshim#708 Windows Host Compute Service bug breaks docker (and other) sandboxes bigger than 20G on Windows 1903
    - fixes microsoft/hcsshim#624The hcsshim on Windows 10 1903 always fails to build Docker image
    - fixes/addresses docker/for-win#3884 An error occurred while attempting to build Docker image (especially this comment and the next comments after: docker/for-win#3884 (comment))
    - fixes/addresses docker/for-win#4100 Windows 1903 fails when storage-opt used
    - fixes moby/moby#36831 hcsshim::PrepareLayer failed in Win32: The parameter is incorrect (moby/moby#36831 (comment))
    - fixes Stannieman/audacity-with-asio-builder#5 Docker won't build container
    - fixes MicrosoftDocs/visualstudio-docs#3523 Error when running build with storage-opts set
    - fixes moby/moby#39524 Docker build windows 19.03 --storage-opt size>20G

Note that this is a temporary workaround for a bug in the platform, and will be reverted once that is addressed:

- microsoft/hcsshim#721 Revert 718 when Windows 19H1 has expand sandbox fix

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Upstream-commit: dff269b5e4b8dc86d12116ac5dff9caca49593d9
Component: cli
mitchcapper added a commit to mitchcapper/CefSharpDockerfiles that referenced this issue Apr 3, 2020
Switch to volumes for storing source during build (faster commit times, resume support, and microsoft/hcsshim#708 bug work around).
To resume see Readme by default will not resume builds.
Moved to vs2019 support for compiling (needs cef patch cef_patch_find_vs2019_tools.diff from sample_patches)
eiffel-fl pushed a commit to eiffel-fl/cli that referenced this issue Jul 28, 2020
full diff: https://2226e083fc390003ae5aa8325c3c92789afa0e7a...b3f49c06ffaeef24d09c6c08ec8ec8425a0303e2

includes:

- microsoft/hcsshim#718 wclayer: Work around Windows bug when expanding sandbox size
    - fixes microsoft/hcsshim#708 Windows Host Compute Service bug breaks docker (and other) sandboxes bigger than 20G on Windows 1903
    - fixes microsoft/hcsshim#624The hcsshim on Windows 10 1903 always fails to build Docker image
    - fixes/addresses docker/for-win#3884 An error occurred while attempting to build Docker image (especially this comment and the next comments after: docker/for-win#3884 (comment))
    - fixes/addresses docker/for-win#4100 Windows 1903 fails when storage-opt used
    - fixes moby/moby#36831 hcsshim::PrepareLayer failed in Win32: The parameter is incorrect (moby/moby#36831 (comment))
    - fixes Stannieman/audacity-with-asio-builder#5 Docker won't build container
    - fixes MicrosoftDocs/visualstudio-docs#3523 Error when running build with storage-opts set
    - fixes moby/moby#39524 Docker build windows 19.03 --storage-opt size>20G

Note that this is a temporary workaround for a bug in the platform, and will be reverted once that is addressed:

- microsoft/hcsshim#721 Revert 718 when Windows 19H1 has expand sandbox fix

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment