acr build task fails with error during hcsshim::System::Start: context deadline exceeded
az acr build --platform windows occasionally fail with "error during hcsshim::System::Start: context deadline exceeded"
After using acr build task with high stability since summer 2020 we have experience instability and increasing failure rates since mid January 2021. Every 10th build or so seam to fail with the context deadline exceeded message.
The docker file and build context itself is rather straight forward (apps, folders, and environment variables).
We have a base image based on servercore:ltsc2019 preinstalled in ACR. Then we run three build tasks to build three separate images based on this. Two of the tasks are triggered in parallel to speed up the pipeline. It seems like it is always one of these that fails.
To Reproduce Steps to reproduce the behavior:
- Add a servercore:ltsc2019 base image to ACR
- Run parallel builds of images based on a servercore:ltsc2019 base image
- Every 10th build or so is expected to fail.
Expected behavior All builds succeeds and a stable behavior is expected.
Screenshots If applicable, add screenshots to help explain your problem.
- OS: Windows
- Azure CLI/PowerShell/SDK version: Hosted agent
- Docker version: ACR build task
- Datetime (UTC) when the issue occurred: Any
- Registry and image names: Premium ACR
Additional context In ACR tasks log we always find the build almost succeed but end with: Step 14/40 : RUN new-item -Path C:\data-files -ItemType Directory | Out-Null ---> Running in ac40d5e08f29 container ac40d5e08f29f56fec8c0b2664fb46f902539bf7aa78dc863f035adf9044b205 encountered an error during hcsshim::System::Start: context deadline exceeded Container failed during run: build. No retries remaining. failed to run step ID: build: exit status 1 Run ID: cgb90 failed after 10m22s. Error: failed during run, err: exit status 1
On client side (az azr build) the error message is different: Client-Request-ID=d35a848a-75eb-11eb-be49-000d3ab2cdac Retry policy did not allow for a retry: Server-Timestamp=Tue, 23 Feb 2021 15:28:48 GMT, Server-Request-ID=dc167ea8-d01e-00bd-7ff8-0927f5000000, HTTP status code=404, Exception=The specified blob does not exist. ErrorCode: BlobNotFound."
Are we doing something we are not supposed to? We find it strange having all these stable builds and now for almost a month seeing this flaky behavior.
@acrokat for "context deadline exceeded" error, it's due to a windows container image issue. Windows team has released the fix at 2/9/2021 and updated all supported images listed in https://hub.docker.com/_/microsoft-windows-servercore . Can you please make sure your own servercore:ltsc2019 base image (the one used in your Dockerfile) has been rebuilt from mcr.microsoft.com/windows/servercore:ltsc2019 to take the fix.
For the client side waring message, it's a CLI issue but it doesn't impact your build.
Thanks @northtyphoon We have double-checked that we uses the very latest base image for Windows. As we have a weekly refresh of servercore base image we started to use the very latest 14th of February.
Microsoft Windows [Version 10.0.17763.1757] (c) 2018 Microsoft Corporation. All rights reserved.
C:\app>systeminfo
Host Name: 136D30222967 OS Name: Microsoft OS Version: 10.0.17763 N/A Build 17763 OS Manufacturer: Microsoft Corporation OS Configuration: Standalone Server OS Build Type: Multiprocessor Free Registered Owner: N/A Registered Organization: N/A Product ID: 00430-00000-00000-AA909 Original Install Date: 2/6/2021, 6:04:27 AM System Boot Time: 2/24/2021, 7:43:44 PM System Manufacturer: Microsoft Corporation System Model: Virtual Machine System Type: x64-based PC Processor(s): 1 Processor(s) Installed. [01]: Intel64 Family 6 Model 158 Stepping 9 GenuineIntel ~2904 Mhz BIOS Version: Microsoft Corporation Hyper-V UEFI Release v4.0, 11/1/2019 Windows Directory: C:\Windows System Directory: C:\Windows\system32 Boot Device: \Device\HarddiskVolume1 System Locale: en-us;English (United States) Input Locale: N/A Time Zone: (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna Total Physical Memory: 1,023 MB Available Physical Memory: 682 MB Virtual Memory: Max Size: 2,751 MB Virtual Memory: Available: 2,396 MB Virtual Memory: In Use: 355 MB Page File Location(s): C:\pagefile.sys Domain: WORKGROUP Logon Server: N/A Hotfix(s): 2 Hotfix(s) Installed. [01]: KB4601393 [02]: KB4601345 Network Card(s): N/A Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.
Which match the image from 9th of February. ltsc2019 | multiarch | windows | 10.0.17763.1757 | 10/03/2018 20:30:05 | 02/09/2021 18:03:24
This investigation made us track back build errors in ACR task history. The interesting thing here is that:
- There are no Faulted builds since 13th of February. Before that date we see the "context deadline exceeded" errors.
- But az acr build continue to occasionally fail with the very same client side error experienced before 14th of February - but now the images are created as expected.
This match your explanation.
Do you have any advice on how to work around the cli issue? We want to fail the pipeline if images are not created and continue when created.
@acerock for the cli error issue, we released a fix in 2.21.0. Can you upgrade to the latest azure cli and try? Please let me know if you still run into the issue.
The CLI issue has been fixed in 2.21.0