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

Version: 1.20.10572.0 reopens last tabs whenever it feels like it #17250

Closed
working-name opened this issue May 11, 2024 · 5 comments · Fixed by #17714
Closed

Version: 1.20.10572.0 reopens last tabs whenever it feels like it #17250

working-name opened this issue May 11, 2024 · 5 comments · Fixed by #17714
Labels
Area-Windowing Window frame, quake mode, tearout In-PR This issue has a related PR Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.

Comments

@working-name
Copy link

working-name commented May 11, 2024

Windows Terminal version

Version: 1.20.10572.0

Windows build number

Version 10.0.22631 Build 22631

Other Software

No response

Steps to reproduce

Open terminal preview.
Open several tabs.
Restart computer either before or after you close down Terminal.
Wonder if it'll restore windows or it won't.

Expected Behavior

Do what the option says: reopen tabs from last session.
fucking-microsoft-again

Actual Behavior

randomly opens last session tabs whenever it feels like it. No option to save my own and restore manually, I'm just living at the mercy of my own (removed expletive to comply with Code of Conduct) computer. It's great.

@working-name working-name added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 11, 2024
@DHowett
Copy link
Member

DHowett commented May 12, 2024

Please adhere to this repository’s Code of Conduct when you are reporting issues.

@working-name
Copy link
Author

Sure thing. Was it "d***" that upset you?

@lhecker
Copy link
Member

lhecker commented May 12, 2024

"damn" is not a problem, your post is simply just too sarcastic. For what reason? I'd understand it if we had done something to offend you, but it's just a bug in the application.
(Edit: To be clear, it's not a big deal. We all use sarcasm after all and there's no reason for you to edit it now. It's just that it'd be more productive if you didn't do it again.)

In any case, we're already aware about this issue and still collecting information when and why it happens. It's likely a race condition during shutdown or something similar, which is why it seems "random". My current theory is that it only happens if you have more than one window open.

@working-name
Copy link
Author

Got it.

Your current theory matches what I experienced about a year ago (don't remember version) when I curbed my behavior to have more than 1 terminal window open before I close it. So this bug also happens when a single window with multiple tabs is open.

I think I made it happen once or twice when I was trying to reproduce it by killing the process from Process Hacker.

@zadjii-msft
Copy link
Member

If I were to posit a theory: I'm guessing you've got some other CLI process that starts at startup. The OS starts that process up, and it picks Terminal as the default terminal handler, and starts the Terminal. Then, when the Terminal starts, it also starts up all the other windows for itself.

Now I'm guessing that the reason why sometimes this doesn't happen is along the lines of #17179 - sometimes, the window state isn't getting persisted if you just straight shutdown the PC.

@carlos-zamora carlos-zamora added this to the Terminal v1.22 milestone May 15, 2024
@carlos-zamora carlos-zamora added Product-Terminal The new Windows Terminal. Area-Windowing Window frame, quake mode, tearout and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 15, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Aug 14, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Aug 20, 2024
DHowett pushed a commit that referenced this issue Aug 21, 2024
Once all applications that have received a `WM_ENDSESSION` message
have returned from processing said message, windows will terminate
all processes. This forces us to process the message synchronously.
This meant that this issue was timing dependent. If Windows Terminal
was quick at persisting buffers and you had some other application that
was slow to shut down (e.g. Steam), you would never see this issue.

Closes #17179
Closes #17250

## Validation Steps Performed
* Set up a lean Hyper-V VM for fast reboots
* `Set-VMComPort <vm> 1 \\.pipe\\<pipe>`
* Hook up WIL to write to COM1
* Add a ton of debug prints all over the place
* Read COM output with Putty for hours
* RTFM, and notice that the `WM_ENDSESSION` documentation states
  "the session can end any time after all applications
  have returned from processing this message"
* Be very very sad ✅
* Fix it
* Rebooting now shows on COM1 that persistence runs ✅
* Windows get restored after reboot ✅

(cherry picked from commit b439925)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgSGCik
Service-Version: 1.21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Windowing Window frame, quake mode, tearout In-PR This issue has a related PR Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants