Repository navigation
Avoid deadlocks with app execution aliases - #373
Merged
dscho merged 1 commit intoSep 28, 2026
Merged
Conversation
Calling `winget.exe` through its app execution alias from an interactive MSYS2 shell can leave the shell hanging after `winget.exe` exits. This affects all app execution aliases, not only `winget.exe`. App execution alias handling was introduced in 0631c66 (Cygwin: Treat Windows Store's "app execution aliases" as symbolic links, 2021-03-22), and 6c3d269 (Cygwin: termios: Handle app execution alias in is_console_app(), 2025-12-10) taught `is_console_app()` to follow aliases using another `path_conv`, which allocates cygheap memory. 618eb90fc2 (Cygwin: console: Fix undesired mode change at exit of non-cygwin apps, 2026-09-19) added a second `is_console_app()` call from `wait_for_resume_if_necessary()`. Unfortunately, at that point, `child_info_spawn::worker()` already holds the non-recursive `cygheap_protect`, so following an alias tries to acquire the same lock recursively and deadlocks. Let's avoid running `is_console_app()` under that lock by instead classifying the executable _once_, in `spawn_worker::setup()`, before acquiring the cygheap lock, then cache and reuse the result for both PTY setup and the post-resume wait. Addresses: msys2#372 Fixes: 618eb90fc2 (Cygwin: console: Fix undesired mode change at exit of non-cygwin apps, 2026-09-19) Signed-off-by: Christoph Reiter <reiter.christoph@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 task done
Member
|
lgtm |
lazka
pushed a commit
to msys2/MSYS2-packages
that referenced
this pull request
Sep 28, 2026
msys2/msys2-runtime#372 reports that calling `winget.exe` through its app execution alias from an interactive MSYS2 shell can leave the shell hanging after `winget.exe` exits. This affects all app execution aliases, not only `winget.exe`. App execution alias handling was introduced in 0631c66 (Cygwin: Treat Windows Store's "app execution aliases" as symbolic links, 2021-03-22), and 6c3d269 (Cygwin: termios: Handle app execution alias in is_console_app(), 2025-12-10) taught `is_console_app()` to follow aliases using another `path_conv`, which allocates cygheap memory. 618eb90fc2 (Cygwin: console: Fix undesired mode change at exit of non-cygwin apps, 2026-09-19) added a second `is_console_app()` call from `wait_for_resume_if_necessary()`. Unfortunately, at that point, `child_info_spawn::worker()` already holds the non-recursive `cygheap_protect`, so following an alias tries to acquire the same lock recursively and deadlocks. Let's avoid running `is_console_app()` under that lock by instead classifying the executable _once_, in `spawn_worker::setup()`, before acquiring the cygheap lock, then cache and reuse the result for both PTY setup and the post-resume wait. This addresses msys2/msys2-runtime#372 This corresponds to msys2/msys2-runtime#373
github-actions Bot
pushed a commit
to cygapiss/msys2-apiss
that referenced
this pull request
Sep 28, 2026
…736) msys2/msys2-runtime#372 reports that calling `winget.exe` through its app execution alias from an interactive MSYS2 shell can leave the shell hanging after `winget.exe` exits. This affects all app execution aliases, not only `winget.exe`. App execution alias handling was introduced in 0631c6644e (Cygwin: Treat Windows Store's "app execution aliases" as symbolic links, 2021-03-22), and 6c3d26961d (Cygwin: termios: Handle app execution alias in is_console_app(), 2025-12-10) taught `is_console_app()` to follow aliases using another `path_conv`, which allocates cygheap memory. 618eb90fc2 (Cygwin: console: Fix undesired mode change at exit of non-cygwin apps, 2026-09-19) added a second `is_console_app()` call from `wait_for_resume_if_necessary()`. Unfortunately, at that point, `child_info_spawn::worker()` already holds the non-recursive `cygheap_protect`, so following an alias tries to acquire the same lock recursively and deadlocks. Let's avoid running `is_console_app()` under that lock by instead classifying the executable _once_, in `spawn_worker::setup()`, before acquiring the cygheap lock, then cache and reuse the result for both PTY setup and the post-resume wait. This addresses msys2/msys2-runtime#372 This corresponds to msys2/msys2-runtime#373 Source: msys2/MSYS2-packages@3c4cc77
catull
pushed a commit
to catull/MSYS2-packages
that referenced
this pull request
Oct 8, 2026
msys2/msys2-runtime#372 reports that calling `winget.exe` through its app execution alias from an interactive MSYS2 shell can leave the shell hanging after `winget.exe` exits. This affects all app execution aliases, not only `winget.exe`. App execution alias handling was introduced in 0631c66 (Cygwin: Treat Windows Store's "app execution aliases" as symbolic links, 2021-03-22), and 6c3d269 (Cygwin: termios: Handle app execution alias in is_console_app(), 2025-12-10) taught `is_console_app()` to follow aliases using another `path_conv`, which allocates cygheap memory. 618eb90fc2 (Cygwin: console: Fix undesired mode change at exit of non-cygwin apps, 2026-09-19) added a second `is_console_app()` call from `wait_for_resume_if_necessary()`. Unfortunately, at that point, `child_info_spawn::worker()` already holds the non-recursive `cygheap_protect`, so following an alias tries to acquire the same lock recursively and deadlocks. Let's avoid running `is_console_app()` under that lock by instead classifying the executable _once_, in `spawn_worker::setup()`, before acquiring the cygheap lock, then cache and reuse the result for both PTY setup and the post-resume wait. This addresses msys2/msys2-runtime#372 This corresponds to msys2/msys2-runtime#373
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#372 reports that calling
winget.exethrough its app execution alias from an interactive MSYS2 shell can leave the shell hanging afterwinget.exeexits. This affects all app execution aliases, not onlywinget.exe.App execution alias handling was introduced in 0631c66 (Cygwin: Treat Windows Store's "app execution aliases" as symbolic links, 2021-03-22), and 6c3d269 (Cygwin: termios: Handle app execution alias in is_console_app(), 2025-12-10) taught
is_console_app()to follow aliases using anotherpath_conv, which allocates cygheap memory.618eb90fc2 (Cygwin: console: Fix undesired mode change at exit of non-cygwin apps, 2026-09-19) added a second
is_console_app()call fromwait_for_resume_if_necessary(). Unfortunately, at that point,child_info_spawn::worker()already holds the non-recursivecygheap_protect, so following an alias tries to acquire the same lock recursively and deadlocks.Let's avoid running
is_console_app()under that lock by instead classifying the executable once, inspawn_worker::setup(), before acquiring the cygheap lock, then cache and reuse the result for both PTY setup and the post-resume wait.This addresses #372