-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Terminal crashes when exiting a bash shell #13880
Comments
This might be a duplicate of #12068. Possibly also #13337 (they initially said they weren't doing anything when the terminal crashed, but later crashes occurred when "attempting to exit restored tabs" which sounds similar to what I'm seeing). I'm surprised we don't have had more reports like this, though, because it's really easy for me to produce, but I guess there's an element of timing involved. I've also only noticed this recently, so I'm wondering if there's something we've changed that has made it easier to trigger. |
This commit seems to be related (although I don't immediately see why that would be): 23e4d31 It tries to work around a deadlock issue by calling
This PR is my attempt to fix one bug caused by that commit: #13859 In either case I believe the underlying issue is this: terminal/src/cascadia/TerminalControl/ControlCore.cpp Lines 99 to 100 in a85d9e6
The comment is wrong. Just because an event has been revoked, doesn't mean it's not currently being called by another thread, right? |
I don't think that's to blame, because I'm also getting this crash in preview release 1.15.1862.0, which I think predates that commit.
I was wondering that too. I don't fully understand what's going on in that code, but my initial impression was that it shouldn't ever have worked.
Yeah, I was thinking the same thing. |
As noted by the `winrt::event` documentation: > [...] But for asynchronous events, even after revoking [...], an in-flight > event might reach your object after it has started destructing. This is because while adding/removing/calling event handlers might be thread-safe, there's no guarantee that they run mutually exclusive. This commit fixes the issue by reverting 6f0f245. Since we never checked the result of closing a terminal connection anyways, this commit simply drops the wait on the connection being teared down to ensure #1996 doesn't regress. Closes #13880 ## Validation Steps Performed * Open tab, close tab, open tab, close tab, open tab, close tab * ConPTY ✅ * Azure ✅ * Closing a tab with a huge amount of panes ✅ * Opening a bunch of tabs and then closing the window ✅ * Closing a tab while it's busy with VT ✅ * `wtd -w 0 nt cmd /c exit` ✅ * `wtd -w -1 cmd /c exit` * No WerFault spawns ✅
🎉This issue was addressed in #13882, which has now been successfully released as Handy links: |
As noted by the `winrt::event` documentation: > [...] But for asynchronous events, even after revoking [...], an in-flight > event might reach your object after it has started destructing. This is because while adding/removing/calling event handlers might be thread-safe, there's no guarantee that they run mutually exclusive. This commit fixes the issue by reverting 6f0f245. Since we never checked the result of closing a terminal connection anyways, this commit simply drops the wait on the connection being teared down to ensure #1996 doesn't regress. Closes #13880 ## Validation Steps Performed * Open tab, close tab, open tab, close tab, open tab, close tab * ConPTY ✅ * Azure ✅ * Closing a tab with a huge amount of panes ✅ * Opening a bunch of tabs and then closing the window ✅ * Closing a tab while it's busy with VT ✅ * `wtd -w 0 nt cmd /c exit` ✅ * `wtd -w -1 cmd /c exit` * No WerFault spawns ✅ (cherry picked from commit 666c446) Service-Card-Id: 86178273 Service-Version: 1.15
🎉This issue was addressed in #13882, which has now been successfully released as Handy links: |
Windows Terminal version
1.15.1862.0
Windows build number
10.0.19044.1889
Other Software
WSL with Ubuntu 20.04.4 LTS
Steps to reproduce
exit
).Expected Behavior
The terminal should remain open after the bash shell exits, with the other tab still working.
Actual Behavior
The terminal crashes.
I was able to reproduce this in the debugger with a build derived from commit c12987a, and the stack trace for the crash looked like this:
The problem, as far as I can make out, is that the
ControlCore
instance is deleted at this point in time. If you look atControlCore::Close
method, we're closing the connection asynchronously, which I think means we're still receiving VT sequences (in this case\e[3J
) afterControlCore
is gone. Assuming I've understood that correctly, that would probably explain the crash.The text was updated successfully, but these errors were encountered: