Skip to content

GHA/windows: replace GfW with MSYS2 runtime downgrade - #16424

Closed
vszakats wants to merge 10 commits into
curl:masterfrom
vszakats:gha-back-to-msys2
Closed

vszakats wants to merge 10 commits into
curl:masterfrom
vszakats:gha-back-to-msys2

Conversation

@vszakats

@vszakats vszakats commented Feb 21, 2025 •

Copy link
Copy Markdown
Member

We recently switched to a known good version of Git for Windows to avoid
the MSYS2/Cygwin runtime performance regression.

MSYS2 is closer to the source of the MSYS2/Cygwin projects. Its known
good version is newer. Installing the downgrade is faster and safer. It
also allows to restore the scripts to their original iteration, making
the workaround easier to drop once the perf issue is fixed upstream.

Therefore, switch back to using MSYS2, and install the runtime downgrade
before running curl tests.

Also disable pacman's CheckSpace for best performance.

Jeremy identified to the root cause of the perf regression in this
Cygwin commit (from 2024-09-17):
https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=c7fe29f5cb85242ae2607945762f7e0b9af02513

Co-authored-by: Jeremy Drake
Patch: jeremyd2019@95a404e
Ref: #16217 (comment)
Ref: #16217 (comment)

Follow-up to 116950a #16265
Follow-up to 1bf774d #16217
Follow-up to 5f9411f #15380


/cc @jeremyd2019

@vszakats vszakats added tidy-up CI Continuous Integration labels Feb 21, 2025
@github-actions github-actions Bot added the Windows Windows-specific label Feb 21, 2025
Comment thread .github/workflows/windows.yml Outdated
- name: 'downgrade msys2-runtime'
if: ${{ matrix.tflags != 'skipall' && matrix.tflags != 'skiprun' }}
timeout-minutes: 2
run: exec /usr/bin/pacman --noconfirm --noprogressbar --upgrade https://mirror.msys2.org/msys/x86_64/msys2-runtime-3.5.4-8-x86_64.pkg.tar.zst

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
run: exec /usr/bin/pacman --noconfirm --noprogressbar --upgrade https://mirror.msys2.org/msys/x86_64/msys2-runtime-3.5.4-8-x86_64.pkg.tar.zst
run: |
/usr/bin/sed -i -e 's/^CheckSpace/#CheckSpace/' /etc/pacman.conf
exec /usr/bin/pacman --noconfirm --noprogressbar --upgrade https://mirror.msys2.org/msys/x86_64/msys2-runtime-3.5.4-8-x86_64.pkg.tar.zst

?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah, I see 9b1a2d0 but msys2's /usr/bin wasn't on the path there, you were probably getting the sed from the default gfw install, who doesn't have /etc/pacman.conf in its root. Confusing, huh?

@jeremyd2019 jeremyd2019 Feb 21, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could use the setup-msys2 action with release: false to still use the default C:\msys64 install, but get the benefit of setting shell: msys2 {0} and having it provide you with a consistent PATH... Something to think about. You might also need path-type: inherit for your use-case too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Let's try that quick! (The downgrade is already quicker than the GfW install.)

Thanks for your tips, it'd be nice to install into the default path. I'll try it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sed tests OK with the abs path.

@jeremyd2019

jeremyd2019 commented Feb 21, 2025 •

Copy link
Copy Markdown
Contributor

Normally, upgrading or downgrading msys2-runtime is supposed to be done as part of the "Core" updates phase of pacman's sysupgrade process, which kills all processes with msys-2.0.dll loaded afterwards. Since you moved the downgrade later in the workflow, there is a greater chance that there are such processes hanging around. There apparently aren't any, though, because if there were any msys2 processes started after that would be failing very loudly.

(this is also why I exec pacman: I want the bash that started it gone ASAP)

@vszakats

vszakats commented Feb 21, 2025 •

Copy link
Copy Markdown
Member Author

Normally, upgrading or downgrading msys2-runtime is supposed to be done as part of the "Core" updates phase of pacman's sysupgrade process, which kills all processes with msys-2.0.dll loaded afterwards. Since you moved the downgrade later in the workflow, there is a greater chance that there are such processes hanging around. There apparently aren't any, though, because if there were any msys2 processes started after that would be failing very loudly.

(this is also why I exec pacman: I want the bash that started it gone ASAP)

Oh OK, that's neat, I was wondering about exec :)

We shouldn't have any process running at that step, except the shell itself.
In these jobs we're just using the MSYS2 coming with the image as-is; there
is no install/upgrade earlier. We can do the downgrade in the beginning if late
is risky, but I try to do everything as late, but no later, than necessary to
return results (failures) as early/quickly as possible. It also brings related
steps closer to each other.

If this starts causing issues, I can amend it in a follow-up patch. It looks solid
so far.

@vszakats vszakats closed this in d4896d9 Feb 21, 2025
@vszakats

Copy link
Copy Markdown
Member Author

Thanks @jeremyd2019, this is merged now.

Continuing in #16429 with installing over the default MSYS2.

@vszakats
vszakats deleted the gha-back-to-msys2 branch March 13, 2025 01:48
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
We recently switched to a known good version of Git for Windows to avoid
the MSYS2/Cygwin runtime performance regression.

MSYS2 is closer to the source of the MSYS2/Cygwin projects. Its known
good version is newer. Installing the downgrade is faster and safer. It
also allows to restore the scripts to their original iteration, making
the workaround easier to drop once the perf issue is fixed upstream.

Therefore, switch back to using MSYS2, and install the runtime downgrade
before running curl tests.

Also disable `pacman`'s `CheckSpace` for best performance.

Jeremy identified to the root cause of the perf regression in this
Cygwin commit (from 2024-09-17):
https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=c7fe29f5cb85242ae2607945762f7e0b9af02513

Co-authored-by: Jeremy Drake
Patch: jeremyd2019@95a404e
Ref: curl#16217 (comment)
Ref: curl#16217 (comment)

Follow-up to 116950a curl#16265
Follow-up to 1bf774d curl#16217
Follow-up to 5f9411f curl#15380

Closes curl#16424
vszakats added a commit to vszakats/curl that referenced this pull request Jun 22, 2025
No longer necessary after bumping the default runtime to a version
fixing the previously experienced performance drop.

Thanks to MSYS2/Cygwin teams for the help and fix.

Follow-up to 9a26be1 curl#17708
Follow-up to d4896d9 curl#16424
vszakats added a commit that referenced this pull request Jun 22, 2025
No longer necessary after bumping the default runtime to a version
fixing the previously experienced performance drop.

Thanks to MSYS2/Cygwin teams for the help and fix.

Follow-up to 9a26be1 #17708
Follow-up to d4896d9 #16424

Closes #17710
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Continuous Integration tidy-up Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

2 participants