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

Fix a coroutine AV crash #16412

Merged
merged 1 commit into from Dec 4, 2023
Merged

Fix a coroutine AV crash #16412

merged 1 commit into from Dec 4, 2023

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Dec 2, 2023

tl;dr: A coroutine lambda does not hold onto captured variables.
This causes an AV crash when closing tabs. I randomly noticed this
in a Debug build as the memory contents got replaced with 0xCD.
In a Release build this bug is probably fairly subtle and not common.

@lhecker lhecker added Priority-1 A description (P1) Issue-Bug It either shouldn't be doing this or needs an investigation. Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Product-Terminal The new Windows Terminal. labels Dec 2, 2023
@lhecker lhecker added this to the Terminal v1.20 milestone Dec 2, 2023
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

What a horrible implementation detail.

@DHowett DHowett added this to To Cherry Pick in 1.18 Servicing Pipeline via automation Dec 4, 2023
@DHowett DHowett added this to To Cherry Pick in 1.19 Servicing Pipeline via automation Dec 4, 2023
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

I'd be shocked if this was the only file with this pattern in it. Maybe we need to broadly do a sweep of "event callback lambda's considered harmful"

@DHowett DHowett merged commit 91fd7d0 into main Dec 4, 2023
15 of 17 checks passed
@DHowett DHowett deleted the dev/lhecker/coroutine-crash branch December 4, 2023 22:58
@lhecker
Copy link
Member Author

lhecker commented Dec 4, 2023

I did try to find other instances of lambdas-that-are-coroutines but couldn't. I believe these were the only ones, thankfully!

@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.19 Servicing Pipeline Dec 4, 2023
DHowett pushed a commit that referenced this pull request Dec 4, 2023
tl;dr: A coroutine lambda does not hold onto captured variables.
This causes an AV crash when closing tabs. I randomly noticed this
in a Debug build as the memory contents got replaced with 0xCD.
In a Release build this bug is probably fairly subtle and not common.

(cherry picked from commit 91fd7d0)
Service-Card-Id: 91258717
Service-Version: 1.19
@DHowett DHowett moved this from To Cherry Pick to Cherry Picked in 1.18 Servicing Pipeline Jan 26, 2024
DHowett pushed a commit that referenced this pull request Jan 26, 2024
tl;dr: A coroutine lambda does not hold onto captured variables.
This causes an AV crash when closing tabs. I randomly noticed this
in a Debug build as the memory contents got replaced with 0xCD.
In a Release build this bug is probably fairly subtle and not common.

(cherry picked from commit 91fd7d0)
Service-Card-Id: 91258716
Service-Version: 1.18
@DHowett DHowett moved this from Cherry Picked to Shipped in 1.19 Servicing Pipeline Feb 21, 2024
@DHowett DHowett moved this from Cherry Picked to Shipped in 1.18 Servicing Pipeline Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Terminal The new Windows Terminal.
Development

Successfully merging this pull request may close these issues.

None yet

3 participants