Potential crash in bell player #18060

Closed
opened 2026-01-31 06:02:32 +00:00 by claunia · 4 comments
Owner

Originally created by @zadjii-msft on GitHub (Jul 28, 2022).

4e5a0c137b/src/cascadia/TerminalApp/Pane.cpp (L1035-L1082)

Just look at it for a while.

  1. We instantiate the bell player on L150.
  2. We confirm it exists on L1054
  3. We start playing the media.
  4. We set up a callback for when the media ends, on L1063
  5. When the media ends (on another thread), the callback is triggered
  6. In that callback, we close the old MediaPlayer, and null it out

If the main thread gets past 2, but the BG thread gets to 6 before the main thread gets to 2, then 💥

We could probably just gate these on the createCloseLock. We only want one thread messing with the bell player at a time, and FRANKLY I don't think starting/stopping a bell sound is gonna be detrimental to the responsiveness of creating/closing a pane.

Originally created by @zadjii-msft on GitHub (Jul 28, 2022). https://github.com/microsoft/terminal/blob/4e5a0c137b045d9f1f34114d12bc3b0ed0a03800/src/cascadia/TerminalApp/Pane.cpp#L1035-L1082 Just look at it for a while. 1. We instantiate the bell player on L150. 2. We confirm it exists on L1054 3. We start playing the media. 4. We set up a callback for when the media ends, on L1063 5. When the media ends (on another thread), the callback is triggered 6. In that callback, we close the old MediaPlayer, and _null it out_ If the main thread gets past 2, but the BG thread gets to 6 before the main thread gets to 2, then **💥** We could probably just gate these on the createCloseLock. We only want one thread messing with the bell player at a time, and FRANKLY I don't think starting/stopping a bell sound is gonna be detrimental to the responsiveness of creating/closing a pane.
Author
Owner

@pingzing commented on GitHub (Aug 1, 2022):

I think I may actually be hitting this, or something in a similar area. If I rapidly trigger BELs with a custom bell sound set, I can reliably crash the terminal.

Terminal Version

1.14.1962.0

Windows Build number

10.0.19044.0

Reproduction

I can reliably trigger this in PowerShell and Bash, and even PowerShell-inside-WSL.

The profile that's experiencing the crash looks like this:

{
                "background": "#1A263E",
                "backgroundImage": "%USERPROFILE%\\OneDrive\\.windowsterrminal\\luna_silhouette.png",
                "backgroundImageOpacity": 0.20000000000000001,
                "backgroundImageStretchMode": "uniformToFill",
                "bellSound": 
                [
                    "C:\\Users\\mcali\\OneDrive\\.windowsterrminal\\sounds\\Honk1.mp3",
                    "C:\\Users\\mcali\\OneDrive\\.windowsterrminal\\sounds\\Honk2.mp3",
                    "C:\\Users\\mcali\\OneDrive\\.windowsterrminal\\sounds\\Honk3.mp3",
                    "C:\\Users\\mcali\\OneDrive\\.windowsterrminal\\sounds\\Honk4.mp3"
                ],
                "bellStyle": 
                [
                    "audible",
                    "window",
                    "taskbar"
                ],
                "colorScheme": "Campbell Powershell",
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "pwsh",
                "opacity": 70,
                "source": "Windows.Terminal.PowershellCore",
                "useAcrylic": true
            },

I did suspect that the OneDrive location may have been introducing some latency, and mucking things up, but this happens even if:

  1. I only have a single .mp3 in the bellSound array
  2. The file is in a non-OneDrive folder.

This is super easy to reproduce by firing a BEL sound in a loop, with a short delay, either manually, or by doing something like this:

(0..100) | % { Write-Host "`a"; Start-Sleep -Seconds 1 }
@pingzing commented on GitHub (Aug 1, 2022): I think I may actually be hitting this, or something in a similar area. If I rapidly trigger BELs with a custom bell sound set, I can reliably crash the terminal. ## Terminal Version 1.14.1962.0 ## Windows Build number 10.0.19044.0 ## Reproduction I can reliably trigger this in PowerShell and Bash, and even PowerShell-inside-WSL. The profile that's experiencing the crash looks like this: ```json { "background": "#1A263E", "backgroundImage": "%USERPROFILE%\\OneDrive\\.windowsterrminal\\luna_silhouette.png", "backgroundImageOpacity": 0.20000000000000001, "backgroundImageStretchMode": "uniformToFill", "bellSound": [ "C:\\Users\\mcali\\OneDrive\\.windowsterrminal\\sounds\\Honk1.mp3", "C:\\Users\\mcali\\OneDrive\\.windowsterrminal\\sounds\\Honk2.mp3", "C:\\Users\\mcali\\OneDrive\\.windowsterrminal\\sounds\\Honk3.mp3", "C:\\Users\\mcali\\OneDrive\\.windowsterrminal\\sounds\\Honk4.mp3" ], "bellStyle": [ "audible", "window", "taskbar" ], "colorScheme": "Campbell Powershell", "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": false, "name": "pwsh", "opacity": 70, "source": "Windows.Terminal.PowershellCore", "useAcrylic": true }, ``` I _did_ suspect that the OneDrive location may have been introducing some latency, and mucking things up, but this happens even if: 1) I only have a single .mp3 in the bellSound array 2) The file is in a non-OneDrive folder. This is super easy to reproduce by firing a BEL sound in a loop, with a short delay, either manually, or by doing something like this: ```powershell (0..100) | % { Write-Host "`a"; Start-Sleep -Seconds 1 } ```
Author
Owner

@Lexicality commented on GitHub (Aug 27, 2022):

I have also been triggering this since the feature was implemented, mostly by getting angry and hitting ^c a lot. Unfortunately the terminal crashing tends to make me more angry and have to go have a sit down and a cup of tea so I've never got around to reporting the bug 😓

@Lexicality commented on GitHub (Aug 27, 2022): I have also been triggering this since the feature was implemented, mostly by getting angry and hitting ^c a lot. Unfortunately the terminal crashing tends to make me more angry and have to go have a sit down and a cup of tea so I've never got around to reporting the bug 😓
Author
Owner

@miiichael commented on GitHub (Aug 30, 2023):

Who would have thought that going 'beep' would be so fraught? I too can reproduce this reliably with 1.17.11461.0 on win10.

  • set bellSound to c:\\windows\\media\\windows ding.wav
  • in your linux of choice, run: echo -e '\x7';sleep 1.5;echo -e '\x7';sleep 1;echo "huh, repro failed!"
  • a short time after the second beep, Windows Terminal crashes (hence the second sleep).

Using the built-in default sound, or c:\windows\media\ding.wav (or windows default.wav), does not elicit the crash.

Example event:

Faulting application name: WindowsTerminal.exe, version: 1.17.2305.26001, time stamp: 0x647122fe
Faulting module name: TerminalApp.dll, version: 1.17.2305.26001, time stamp: 0x6471227a
Exception code: 0xc0000005
Fault offset: 0x000000000014faff
Faulting process ID: 0x3778
Faulting application start time: 0x01d9db088e23b158
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe\TerminalApp.dll
Report ID: 28afed31-45ca-4013-a2db-d58d5c07a473
Faulting package full name: Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

No, I don't have Sonic Studio/Radar installed (#10957)

@miiichael commented on GitHub (Aug 30, 2023): Who would have thought that going 'beep' would be so fraught? I too can reproduce this reliably with 1.17.11461.0 on win10. - set `bellSound` to `c:\\windows\\media\\windows ding.wav` - in your linux of choice, run: `echo -e '\x7';sleep 1.5;echo -e '\x7';sleep 1;echo "huh, repro failed!"` - a short time after the second beep, Windows Terminal crashes (hence the second sleep). Using the built-in default sound, or c:\windows\media\ding.wav (or windows default.wav), does not elicit the crash. Example event: ``` Faulting application name: WindowsTerminal.exe, version: 1.17.2305.26001, time stamp: 0x647122fe Faulting module name: TerminalApp.dll, version: 1.17.2305.26001, time stamp: 0x6471227a Exception code: 0xc0000005 Fault offset: 0x000000000014faff Faulting process ID: 0x3778 Faulting application start time: 0x01d9db088e23b158 Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe\TerminalApp.dll Report ID: 28afed31-45ca-4013-a2db-d58d5c07a473 Faulting package full name: Microsoft.WindowsTerminal_1.17.11461.0_x64__8wekyb3d8bbwe Faulting package-relative application ID: App ``` No, I don't have Sonic Studio/Radar installed (#10957)
Author
Owner

@lhecker commented on GitHub (Aug 30, 2023):

This issue was fixed in #15333 and is available in https://github.com/microsoft/terminal/releases/tag/v1.18.1462.0.
Edit: ...and sorry that it took so long to fix this!

@lhecker commented on GitHub (Aug 30, 2023): This issue was fixed in #15333 and is available in https://github.com/microsoft/terminal/releases/tag/v1.18.1462.0. Edit: ...and sorry that it took so long to fix this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18060