Repository navigation
Stage a viewer's queue before a Windows update stops it - #1012
Merged
Merged
Conversation
On Windows the update's shell stops whatever runs from the tray's store before it updates, and that takes in a viewer started from the tray's own viewer folder. One that held the inline queue held it in memory and stages it only as it exits, so its snapshots went with it. Once the shell has started, the tray now finds the process listening on the viewer port, out of the same row of Windows' listener table that ListenerTable already reads, and if it runs from somewhere the update stops, sends it Quit and waits up to fifteen seconds for it to go. An owning viewer takes a Quit from the wire as exiting whatever a tray says, and stages its queue on the way out. A viewer from anywhere else is left alone, since nothing stops it, and so is a queue the tray holds itself, which it stages as it exits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, the tray's Update stops whatever runs from the tray's store before it updates, since a file in use can't be replaced. That includes a viewer started from the tray's own viewer folder. A viewer that held the inline queue holds it in memory and stages it only as it exits, so being stopped lost every snapshot in it. The docs said to accept or close what was pending before updating.
The change.
ListenerTable.Owner(port)returns the id of the process listening on a port. It comes from the same row of Windows' listener table thatListenerTablealready reads, which ends with the owning process's id in both layouts. It returns null off Windows, or wherever the table can't be read.TrayUpdate.Start, once the update's shell has started and before the tray exits, callsTrayUpdate.CloseOwningViewer. That:TrayUpdate.Stops: under the store orAlsoStopUnder, ignoring case, by whole folders);Quitand waits up to fifteen seconds for it to go. The shell waits thirty for the tray.Quitfrom the wire already makes a viewer that owns the queue exit, whatever a tray says, and the viewer stages its queue on the way out. Only a close by hand hides the window beside a tray.Tests.
ListenerTableTests.AListenerSaysWhoseItIs: this process, for a listener of either family, and null once it stops.TrayUpdateTests.TheUpdateStopsWhatRunsFromTheStore: the store andAlsoStopUndermatch, whatever the case, and a sibling folder that only starts with the same name doesn't.TrayUpdateTests.AViewerTheUpdateStopsIsAskedToClose: Windows PowerShell stands in for the viewer, listening on a port of its own, and the update is told to stop under PowerShell's folder. The stand-in is found by the table, sentverb: quitand has exited.TrayUpdateTests.AViewerTheUpdateLeavesAloneIsLeftAloneandAQueueThisTrayHoldsIsNotAskedToClose: nothing is sent.ViewerProgramTests.AQuitFromTheWireClosesBesideATray: with the tray's mutex held and a snapshot queued, aClosefrom the wire ends the loop without a frame.Locally on Windows, a Release build had no errors, and:
ListenerTable.Enumeratedones that always fail on Windows 10.0.26300, where .NET leaves listeners out of its list; CI passes them.Not seen working. I didn't run a real update against a real viewer holding a queue.