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 session persistence when the session ends #17714

Merged
merged 3 commits into from
Aug 20, 2024

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Aug 14, 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 ✅

@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-Windowing Window frame, quake mode, tearout Product-Terminal The new Windows Terminal. labels Aug 14, 2024
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.

oh thank you thank you thank you thank you thank you

@lhecker lhecker merged commit b439925 into main Aug 20, 2024
20 checks passed
@lhecker lhecker deleted the dev/lhecker/17179-persist-reboot branch August 20, 2024 11:24
DHowett pushed a commit that referenced this pull request 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 Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
3 participants