From 9ea0823e4cdf0a0f9804abcecac5ca11696ad39d Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Tue, 2 Dec 2025 15:23:10 +0000 Subject: [PATCH 1/3] fix: add retry logic and disable timeout for MSYS2 pacman in Windows builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MSYS2 mirrors can be slow or overloaded, causing pacman to fail with "Operation too slow" errors during cibuildwheel builds on Windows runners. This fix adds: - 3-attempt retry loop with 15-second delays between attempts - --disable-download-timeout flag to prevent libcurl's speed check from triggering Resolves intermittent Windows build failures on win-cp312 (especially in UMEP variant builds). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/actions/build-suews/action.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-suews/action.yml b/.github/actions/build-suews/action.yml index 42c073c85..c0a70215d 100644 --- a/.github/actions/build-suews/action.yml +++ b/.github/actions/build-suews/action.yml @@ -122,9 +122,12 @@ runs: brew install gfortran && brew unlink gfortran && brew link gfortran + # Windows pacman with retry logic and timeout handling + # MSYS2 mirrors can be slow/overloaded causing "Operation too slow" errors + # Solution: retry loop + --disable-download-timeout (pacman 6.0+) CIBW_BEFORE_ALL_WINDOWS: > - C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm" && - C:\msys64\usr\bin\bash.exe -lc "pacman -S --needed --noconfirm mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-fortran mingw-w64-ucrt-x86_64-binutils mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-openblas" + C:\msys64\usr\bin\bash.exe -lc "for i in 1 2 3; do pacman -Syu --noconfirm --disable-download-timeout && break || { echo 'Retry $i/3: pacman -Syu failed'; sleep 15; }; done" && + C:\msys64\usr\bin\bash.exe -lc "for i in 1 2 3; do pacman -S --needed --noconfirm --disable-download-timeout mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-fortran mingw-w64-ucrt-x86_64-binutils mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-openblas && break || { echo 'Retry $i/3: pacman -S failed'; sleep 15; }; done" # Platform-specific: Windows compiler and toolchain settings CIBW_ENVIRONMENT_WINDOWS: > PATH="C:\\msys64\\ucrt64\\bin;$PATH" From 95ffcb439081a9a6d300e9e7ef66beac95633ebc Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Tue, 2 Dec 2025 15:27:22 +0000 Subject: [PATCH 2/3] fix: handle MSYS2 core package restart during pacman -Syu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When pacman upgrades core packages (pacman, msys2-runtime), MSYS2 terminates all running processes including the bash shell executing the command. This causes the command to exit with code 1 even though the upgrade succeeded. Fix by running pacman -Syu twice in separate shell invocations: - First run: ignore exit code (|| true) as shell may be terminated - Second run: complete any remaining updates in fresh shell - Package install: keep retry logic for network timeouts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/actions/build-suews/action.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/build-suews/action.yml b/.github/actions/build-suews/action.yml index c0a70215d..4086e65d0 100644 --- a/.github/actions/build-suews/action.yml +++ b/.github/actions/build-suews/action.yml @@ -122,12 +122,13 @@ runs: brew install gfortran && brew unlink gfortran && brew link gfortran - # Windows pacman with retry logic and timeout handling - # MSYS2 mirrors can be slow/overloaded causing "Operation too slow" errors - # Solution: retry loop + --disable-download-timeout (pacman 6.0+) + # Windows MSYS2/pacman setup with two workarounds: + # 1. Core package updates (pacman, msys2-runtime) terminate the shell - run twice, ignore first exit + # 2. Mirror timeouts cause "Operation too slow" errors - use --disable-download-timeout + retry CIBW_BEFORE_ALL_WINDOWS: > - C:\msys64\usr\bin\bash.exe -lc "for i in 1 2 3; do pacman -Syu --noconfirm --disable-download-timeout && break || { echo 'Retry $i/3: pacman -Syu failed'; sleep 15; }; done" && - C:\msys64\usr\bin\bash.exe -lc "for i in 1 2 3; do pacman -S --needed --noconfirm --disable-download-timeout mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-fortran mingw-w64-ucrt-x86_64-binutils mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-openblas && break || { echo 'Retry $i/3: pacman -S failed'; sleep 15; }; done" + C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm --disable-download-timeout || true" && + C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm --disable-download-timeout" && + C:\msys64\usr\bin\bash.exe -lc "for i in 1 2 3; do pacman -S --needed --noconfirm --disable-download-timeout mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-fortran mingw-w64-ucrt-x86_64-binutils mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-openblas && break || { echo Retry $i/3 && sleep 15; }; done" # Platform-specific: Windows compiler and toolchain settings CIBW_ENVIRONMENT_WINDOWS: > PATH="C:\\msys64\\ucrt64\\bin;$PATH" From 07b9946ad5d754cfdcea45d399d471a8f9ce2f89 Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Wed, 3 Dec 2025 12:30:10 +0000 Subject: [PATCH 3/3] fix: use Windows-level error suppression for MSYS2 restart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When MSYS2 upgrades core packages, it uses taskkill to forcibly terminate all MSYS2 processes. This kills bash.exe before it can execute any error handling (|| true). The solution is to catch the error at the Windows shell level using (cmd || ver >nul), where 'ver >nul' always succeeds, allowing the command chain to continue. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/actions/build-suews/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-suews/action.yml b/.github/actions/build-suews/action.yml index 4086e65d0..3e116d790 100644 --- a/.github/actions/build-suews/action.yml +++ b/.github/actions/build-suews/action.yml @@ -123,10 +123,11 @@ runs: brew unlink gfortran && brew link gfortran # Windows MSYS2/pacman setup with two workarounds: - # 1. Core package updates (pacman, msys2-runtime) terminate the shell - run twice, ignore first exit + # 1. Core package updates (pacman, msys2-runtime) terminate bash.exe via taskkill - use Windows-level + # error suppression (|| ver >nul) since bash can't execute || true when forcibly killed # 2. Mirror timeouts cause "Operation too slow" errors - use --disable-download-timeout + retry CIBW_BEFORE_ALL_WINDOWS: > - C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm --disable-download-timeout || true" && + (C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm --disable-download-timeout" || ver >nul) && C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm --disable-download-timeout" && C:\msys64\usr\bin\bash.exe -lc "for i in 1 2 3; do pacman -S --needed --noconfirm --disable-download-timeout mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-gcc-fortran mingw-w64-ucrt-x86_64-binutils mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-openblas && break || { echo Retry $i/3 && sleep 15; }; done" # Platform-specific: Windows compiler and toolchain settings