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

Terminal windows are closed whenever updated from the store #3915

Closed
tovine opened this issue Dec 11, 2019 · 17 comments · Fixed by #16250
Closed

Terminal windows are closed whenever updated from the store #3915

tovine opened this issue Dec 11, 2019 · 17 comments · Fixed by #16250
Assignees
Labels
In-PR This issue has a related PR Product-Terminal The new Windows Terminal. Tracking-External This bug isn't resolved, but it's following an external workitem.

Comments

@tovine
Copy link

tovine commented Dec 11, 2019

On several occasions I've experienced that when I leave my computer for a while and come back, all my terminal windows are gone.
After some investigation I've reached the conclusion that this happens because the app was installed through the Microsoft store, and just received an update.

This is probably fine for your average note taking app or Candy Crush game, but for a terminal with several tabs open that do actual work (and perhaps even long-running (like several days) processes open in remote SSH sessions) this is completely unacceptable.

Is there a way to avoid the terminal being restarted after receiving an update through the Store? A notification would be fine to let me know that I should restart it on the earliest convenient moment, but having it just disappear can in the worst case scenario cost me days of work that will need to be restarted, and in the best case some inconvenience and a few minutes to get back to where I was before...

Luckily a workaround exists: disable apps auto-updating (https://support.microsoft.com/en-us/help/15081/windows-turn-on-automatic-app-updates), but is there really no better way of handling this?

Environment

Windows build number: [Version 10.0.18362.418]
Windows Terminal version (if applicable): 0.7.3382.0

Steps to reproduce

Do normal everyday work in terminal, wait for an update to arrive.

Expected behavior

A notification to restart the app at my earliest convenience, or that the app continues to run with the old version, and that all new instances are started as the new version (like in Linux, where executables linger on in RAM until closed regardless of whether the file they started from still exist).
Or at the very least that it would notify me that new updates were available, but not install them.

Actual behavior

Terminal windows suddenly disappear with no explanation whatsoever, before I open the Store app and see that it was just now updated...

Sorry if this issue seems a bit salty, but it's really annoying - right up there with getting to the office in the morning to continue where you left off yesterday, only to find out that the PC rebooted automatically to install Windows updates (hint: not cool).

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Dec 11, 2019
@tovine
Copy link
Author

tovine commented Dec 11, 2019

Actually, the way you're doing it for Visual Studio Code is perfect - why not use the same approach here if possible? :)

@mg-christian-axelsson
Copy link

+1 I just lost hours worth of state because of this behavior.

@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Dec 19, 2019
@bozhodimitrov
Copy link

The other way around is also not good.
Previously I had a lot of errors in my Event Viewer from Windows Update about the fact that Windows Terminal can't be updated, because the executable is running.
We need a better process of updating the app. And it would be nice if we have some kind of configuration options like: automatic restart after update - on/off and so on :)

@mg-christian-axelsson
Copy link

Just having automatic updates install upon next launch would be a perfectly fine behavior.

@CaptFrankSolo
Copy link

Also note, there is a massive difference in these experiences:

  1. windows restarts while my console apps are running and all my terminal state is lost AND my enqueued commands for long-running operations to finish while i am sleeping are in an unknown state
  2. windows restarts for updates after my enqueued commands finish and all my terminal state is lost
  3. windows waits to restart before my enqueued commands finish and restarts terminals with the same windows open
  4. windows waits to restart before my enqueued commands finish, and upon restart, terminal relaunches to to the exact same display state
  5. windows waits to restart before my enqueued commands finish, and upon restart, terminal relaunches to to the exact same display state including command history

please, on behalf of developers everywhere with long build times, consider moving us more and more to #5

@emusgrave
Copy link

@DHowett-MSFT I see that you've mentioned this issue from other closed issues but you have not actually commented here regarding the problem or the intention to fix it. I was about to open a new report because this issue also doesn't capture the entire story. But instead I'll post some findings here and hope that you can shed some more light on what the plans are.

First, the problem is not just that the console sessions are silently closed when the program automatically updates. I haven't been able to fully trace what set of circumstances causes this, but I've had processes just get orphaned. The only reason I even realize this is that when I go to re-open one of my command line processes, I see that the listening port is still in use and I can't open it. I've then had to go searching through TCPView and Process Explorer to find the orphaned process and kill it.

Second, I tried to circumvent all of this by installing the Terminal app via Chocolatey. However, it still gets updated via the Windows Store!? I'm not sure why that would happen if I did not install via the Store.

At the very least I would LOVE an option to disable automatic updates. Another solution might be to tie all updates to Terminal to the next Windows reboot cycle? But I think from your comments on other threads this is what you aren't able to do when distributing via the Store.

I would also make the recommendation to just not distribute this application on the Windows Store. This is not really an ideal app for that delivery mechanism. This is a power user / developer targeted app, so I would think it would be distributed more like Visual Studio or Visual Studio Code, or even Power Toys.

Thanks for your teams work on this app. Unfortunately I am going to have to abandon it until this issue is fixed because I'm losing a lot of time and work every other week when an update is pushed and my long-running processes are lost.

@DHowett
Copy link
Member

DHowett commented May 18, 2020

You've got the critical points down pat.

For right now, it's possible to extract the msixbundle (and the architecture-specific msix inside it) and run WindowsTerminal.exe directly. We're not intending on breaking this. 🤞

@emusgrave
Copy link

@DHowett Thank you for the quick response!

I went ahead and uninstalled my existing copy of Terminal (thereby unlinking it from the Windows Store), and am now running it directly from the exe extracted from the package you referred to. Appears to work the same, although the version number in the about box is listed as 0.11.200512003-release1.0.

Hopefully this helps some others who are struggling with the automatic updates. I will keep an eye on the repo so that I can perform my own updates manually.

@sba923
Copy link

sba923 commented Jul 27, 2020

@DHowett Thank you for the quick response!

I went ahead and uninstalled my existing copy of Terminal (thereby unlinking it from the Windows Store), and am now running it directly from the exe extracted from the package you referred to. Appears to work the same, although the version number in the about box is listed as 0.11.200512003-release1.0.

Hopefully this helps some others who are struggling with the automatic updates. I will keep an eye on the repo so that I can perform my own updates manually.

So you did not install from the msixbundle available from the 'Releases' page?

That's what I just did, and how Store reports the app is 'installed'... so I expect it will still be subject to (auto)updates. Correct?

Can you please elaborate on how you got a runnable instance deployed without Store considering it's installed (and thus needs updating)?

TIA

@emusgrave
Copy link

@sba923 You can "unzip" the msixbundle, and then just run the exe from there. I copied the folder to Program Files and added it to my PATH env for extra convenience.

I have had no problems with auto-updates since doing it this way. I watch the github project for any releases that have fixes/features that I want.

@sba923
Copy link

sba923 commented Jul 28, 2020

@sba923 You can "unzip" the msixbundle, and then just run the exe from there. I copied the folder to Program Files and added it to my PATH env for extra convenience.

I have had no problems with auto-updates since doing it this way. I watch the github project for any releases that have fixes/features that I want.

Thanks for the tip!

I chose not to add the folder to the PATH, because that's not absolutely required (and I have a theory where adding tons of app folders to the PATH would slow down the system...).

Something worth mentioning: uninstalling will delete %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState where the settings.json file is located (I know, that's part of the "good" sandboxing idea beyond store app deployment), so you'll lose your settings if you don't make a copy first.

In the "XCOPY-deployed" instance, the settings.json file resides at %LOCALAPPDATA%\Microsoft\Windows Terminal.

HTH

@jsejcksn
Copy link

I have a theory where adding tons of app folders to the PATH would slow down the system

A bit of research can help you get the info you need in order to be able to perform the necessary tests to confirm/deny your theory so you can start acting on knowledge. Don't act on theories!

@sba923
Copy link

sba923 commented Jul 28, 2020

I have a theory where adding tons of app folders to the PATH would slow down the system

A bit of research can help you get the info you need in order to be able to perform the necessary tests to confirm/deny your theory so you can start acting on knowledge. Don't act on theories!

I support your reasoning, but a simple model proves that the more folders you have on the PATH, and the more items therein, the more time it takes to search for a specified EXE or DLL.

Of course, the actual measurable impact depends on how much optimization (e.g. caching) has been put into that search algorithm, and of the platform's performance.

And that is context and OS-dependent (the articles you refer to pertain to searches done by the bash shell on Unix, my use case is the Windows APIs that rely on EXE/DLL searches on the PATH).

My plan is to start a discussion there hoping that some Microsoft people with knowledge about those internals will react to my "theory."

@RowdyChildren
Copy link
Member

Seeing this issue as well, its very annoying.

@aaroneg

This comment was marked as off-topic.

@DHowett

This comment was marked as off-topic.

@DHowett

This comment was marked as off-topic.

@microsoft microsoft locked as too heated and limited conversation to collaborators Feb 14, 2021
@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Tracking-External This bug isn't resolved, but it's following an external workitem. labels Feb 16, 2021
@zadjii-msft zadjii-msft removed the Needs-Tag-Fix Doesn't match tag requirements label Apr 19, 2022
@DHowett DHowett assigned nguyen-dows and unassigned cinnamon-msft Dec 16, 2022
zadjii-msft added a commit that referenced this issue Nov 1, 2023
Adds

```xml
    <uap17:UpdateWhileInUse>defer</uap17:UpdateWhileInUse>
```

To our `Package.Properties` for all our packages. This was added in the September 2023 OS release of Windows 11.

Apparently, this just works now? I did update VS, but I don't _think_ that
updated the SDK. I have no idea how it updated the manifest definitions.

Closes #3915
Closes #6726
@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Nov 1, 2023
lhecker pushed a commit that referenced this issue Nov 7, 2023
Adds
```xml
<uap17:UpdateWhileInUse>defer</uap17:UpdateWhileInUse>
```
to our `Package.Properties` for all our packages.
This was added in the September 2023 OS release of Windows 11.

Apparently, this just works now? I did update VS,
but I don't _think_ that updated the SDK.
I have no idea how it updated the manifest definitions.

Closes #3915
Closes #6726
radu-cernatescu pushed a commit to radu-cernatescu/terminal that referenced this issue Nov 8, 2023
Adds
```xml
<uap17:UpdateWhileInUse>defer</uap17:UpdateWhileInUse>
```
to our `Package.Properties` for all our packages.
This was added in the September 2023 OS release of Windows 11.

Apparently, this just works now? I did update VS,
but I don't _think_ that updated the SDK.
I have no idea how it updated the manifest definitions.

Closes microsoft#3915
Closes microsoft#6726
DHowett pushed a commit that referenced this issue Nov 13, 2023
Adds
```xml
<uap17:UpdateWhileInUse>defer</uap17:UpdateWhileInUse>
```
to our `Package.Properties` for all our packages.
This was added in the September 2023 OS release of Windows 11.

Apparently, this just works now? I did update VS,
but I don't _think_ that updated the SDK.
I have no idea how it updated the manifest definitions.

Closes #3915
Closes #6726

(cherry picked from commit 077d63e)
Service-Card-Id: 91033136
Service-Version: 1.19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In-PR This issue has a related PR Product-Terminal The new Windows Terminal. Tracking-External This bug isn't resolved, but it's following an external workitem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.