Skip to content

Make installer process safer#16174

Merged
seanbudd merged 7 commits into
rcfrom
fixInstaller
Feb 19, 2024
Merged

Make installer process safer#16174
seanbudd merged 7 commits into
rcfrom
fixInstaller

Conversation

@seanbudd

@seanbudd seanbudd commented Feb 13, 2024

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #16122

Summary of the issue:

NVDA process sometimes fails to quit correctly (see #16123).
When running the installer, this causes the installer to fail partway through.
If the installer fails partway through, the installation may end up in an unrecoverable state.

For certain files, NVDA requests windows to move or delete these on reboot, if the move/delete fails initially.
However, if the Windows API request fails, NVDA does not handle the failure the same way as it handles other failures - raising a retryable failure and reverting the change if possible.

Description of user facing changes

The NVDA installation process should be more resilient if the previous process is still running.

Description of development approach

NVDA attempts to remove all known exes in a batch as the first operation in the installation. If any known NVDA exe is running, the installation is aborted with a retry able failure and all exes returned to their original state. This means the user can attempt the installation again - i.e. waiting a bit longer for the process to hopefully exit.

If NVDA fails to request windows to remove certain files on restart, this is handled the same as if the files are failed to be removed.

More logging has been added and improved.

Testing strategy:

  • Tested manually triggering a retriable failure to ensure the handling is as expected.
  • Manual testing from the community is required to confirm the fix.

Known issues with pull request:

The installation process should be atomic - i.e. if it fails, the whole operation should be reverted. This is not the case of the current design. In future code to NVDA we can specify more files we want to include in the atomic and reversible operation.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@seanbudd seanbudd requested a review from a team as a code owner February 13, 2024 05:35
@seanbudd seanbudd requested review from michaelDCurran and removed request for a team February 13, 2024 05:35
@seanbudd seanbudd marked this pull request as draft February 13, 2024 05:36
@seanbudd seanbudd added this to the 2024.3.4 milestone Feb 13, 2024
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 146037363b

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a minimum I think the psutil stuff is good. I wouldn't want the pr held up due to queries on changing the renames etc. We could do that in beta and or master. But the psutil stuff is just a simple check and fail with a static list of exes. Very safe.

Comment thread appx/sconscript Outdated
Comment thread source/installer.py Outdated
@CyrilleB79

Copy link
Copy Markdown
Contributor

Which milestone did you want to use? 2024.3.4 milestone is clearly erroneous. #16122 has to be retagged too.

@cary-rowen

Copy link
Copy Markdown
Contributor

It might be worth investigating #16123, which might also resolve #16122.
If #16123 does exist, it could also cause an unknown potential flaw.

Comment thread appx/sconscript Outdated
Comment thread appx/sconscript
Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
Comment thread source/installer.py
@Brian1Gaff

This comment was marked as off-topic.

@seanbudd

This comment was marked as off-topic.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit c889fbb97a

@LeonarddeR

Copy link
Copy Markdown
Collaborator

I don't quite understand why we would have to roll out a patch release for this. While this issue was reported more frequently during the last few weeks, the current behavior has been there for almost a decade. This is neither a security fix nor a fix for a regression introduced in the 2023.3 cycle.

@michaelDCurran

michaelDCurran commented Feb 14, 2024 via email

Copy link
Copy Markdown
Member

@LeonarddeR

Copy link
Copy Markdown
Collaborator

My firm opinion is that either we put this into a beta and withhold any further patch releases to 2023.3, or we put it into a 2023.3 patch release, before any further patch releases.

I'd prefer the former. If the latter, I guess the fix can be applied as soon as a patch release is necessary (e.g. as part of a security fix)

@josephsl

josephsl commented Feb 14, 2024 via email

Copy link
Copy Markdown
Contributor

Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
@lukaszgo1

Copy link
Copy Markdown
Contributor

I have to agree with Leonard and Joseph, that adding this into a patch release is sub-optimal, though for different reasons. We have no idea if this fix is going to really help, verifying this is going to be time consuming and probably inconclusive, and frankly while it improves installer in a nice way the underlying problem (NVDA fails to exit in a reasonable time) still remains. It is also unclear how this will help users to upgrade NVDA, granted it will not become corrupted, but if it fails to exit restarting the machine and attempting upgrade once again will cause users to end up in the same state in which old copy of NVDA is running preventing the upgrade. I'd love to see #16123 investigated and will certainly support adding it into a patch release. It also will be preferable to make sure that 2024.1 is not going to be released with #16072 not solved.

@michaelDCurran

michaelDCurran commented Feb 14, 2024 via email

Copy link
Copy Markdown
Member

@seanbudd

Copy link
Copy Markdown
Member Author

Please note that this bug has become a lot more common, and is a p1 issue causing installations to enter an unrecoverable state.

2024.1 is still a long way away. This fix will go through thorough rc, beta and alpha testing before a 2023.3.4 patch release comes out.

@seanbudd seanbudd marked this pull request as ready for review February 15, 2024 04:33
@seanbudd

Copy link
Copy Markdown
Member Author

@cary-rowen @hwf1324 - could you test this try build and see if you run into the installer bug still?

https://ci.appveyor.com/api/buildjobs/g8p72ugj4bw4qf01/artifacts/output%2Fnvda_snapshot_try-fixInstaller-31056%2Cc6a53da2.exe

@hwf1324

This comment was marked as off-topic.

@seanbudd seanbudd marked this pull request as draft February 15, 2024 22:34
@wmhn1872265132

Copy link
Copy Markdown
Contributor
  1. 2023.3.X can be installed manually on Windows 7.
  2. After installing 2023.3.X, check for updates and the 2023.3 version will be detected, which seems to cause trouble to users.

Therefore, it is strongly recommended to allow upgrades to new patch versions. Although these updates may not be tested, in theory they should not cause a worse experience.

@seanbudd

Copy link
Copy Markdown
Member Author

Therefore, it is strongly recommended to allow upgrades to new patch versions.

It is allowed, but not recommended. Windows 7 support was dropped as of 2023.3. Any patch releases after will not be tested with Windows 7.

Although these updates may not be tested, in theory they should not cause a worse experience.

This is not true - the changes to HTML browsable message may break a large number of dialogs on Windows 7

@seanbudd seanbudd marked this pull request as ready for review February 16, 2024 04:27
@lukaszgo1

Copy link
Copy Markdown
Contributor

@seanbudd This approach to dropping Windows 7 support is quite unusual. Given that 5% of your users are running it, the basic thing to do would be to either add the link to 2023.0 to NV Access's downloads web page (as soon as the first untested patch release was published), and clearly state that it should be used on Windows 7, or test these patch releases. While I understand that you have limited resources and performing this testing yourselves may be difficult, one of NVDA's strengths it its community, as far as I can tell you didn't reach out to us asking for testing. Also while at it can we please have a clarification of these patch releases and Windows Server 2012 which is still under extended support until 2026?

@josephsl

josephsl commented Feb 17, 2024 via email

Copy link
Copy Markdown
Contributor

@codeofdusk

codeofdusk commented Feb 17, 2024

Copy link
Copy Markdown
Contributor

I thought Windows 7 support was dropped as of 2024.1? (per the changelog).

Any patch releases on the 2023.x branch should support 7, per my intuition and to remain consistent with the contract not to break APIs. Any subsequent full releases (2024.1 onwards) should not.

@CyrilleB79

Copy link
Copy Markdown
Contributor

To say things more clearly:
The change logs of NVDA 2023.3.1, 2023.3.2 and 2023.3.3 do not indicate that Windows 7 support has been dropped. If it should be the case, it's at least a clear issue in the communication of this information.

For now (in its beta stage), according to its change log, the first version that drops Windows 7 compatibility is 2024.1.

My recommendation would be to do as advertised largely in the change log and elsewhere in the community, i.e. 2024.1 to be the first version dropping Windows 7 support.
If it's not technically possible, I would ask that a much wider and clearer communication be made on that matter. Thanks.
Cc @gerald-hartig

@seanbudd

Copy link
Copy Markdown
Member Author

Windows Server 2012 are still supported by Python, however we are not actively testing or fixing these bugs.

I think there has been some confusion around NV Access development support and whether or not something runs.
2024.1 will not run on Windows 7 and 8. In 2023 NV Access stopped active development support for Windows 7.
We are avoiding encouraging updates to 2023.3.X patch releases on Windows 7 as these are under tested and may be worse compared to 2023.3. Windows 7 users have nothing to gain, and potential risks, for updating from 2023.3

@seanbudd seanbudd modified the milestones: 2023.3.4, 2024.2 Feb 19, 2024
@seanbudd seanbudd changed the base branch from rc to master February 19, 2024 00:44
@cary-rowen

Copy link
Copy Markdown
Contributor

But there is no way to prevent Windows 7 users from manually installing 2023.3.X. As far as the current publicity is concerned, 2024.1 is the version that clearly does not support Windows 7.

It may be natural for people to think that Windows 7 should choose the last version allowed to run on Windows 7. Few people know that NV Access has No longer recommended this.

@seanbudd seanbudd marked this pull request as draft February 19, 2024 01:48
@seanbudd

Copy link
Copy Markdown
Member Author

@cary-rowen - the release posts advertise this information.
The reality is Windows 7 has had no active development support in NVDA for sometime, we are not interested in spending additional developer time or user support for Windows 7 users. All NV Access plans to do as of 2024 is advise on which version we recommend for Windows 7 users, which we are trying to cover in all relevant locations on our website.

@seanbudd seanbudd marked this pull request as ready for review February 19, 2024 02:32
michaelDCurran
michaelDCurran previously approved these changes Feb 19, 2024
@seanbudd seanbudd changed the base branch from master to rc February 19, 2024 04:34
@seanbudd seanbudd dismissed michaelDCurran’s stale review February 19, 2024 04:34

The base branch was changed.

@seanbudd seanbudd modified the milestones: 2024.2, 2023.3.4 Feb 19, 2024
@seanbudd seanbudd merged commit b31f305 into rc Feb 19, 2024
@seanbudd seanbudd deleted the fixInstaller branch February 19, 2024 06:40
seanbudd pushed a commit that referenced this pull request Feb 25, 2024
…talled NVDA extra time to fully exit on the UAC screen (#16205)

Fixes #16199
Fixes #16122

Summary of the issue:
In pr #16174, effort was made to make the installer more robust, including better handling when the installed NVDA is still running, by trying to remove the NVDA exes first, and if any of them fail, restoring them all and not corrupting a user's install.
Although it no longer corrupts the install, it was too fast at at trying to remove the exes and no longer tried multiple times, which did not take into account that the installed NVDA has just been running on the UAC screen, and may still be exiting.

Description of user facing changes
NVDA will try multiple times itself to remove the NVDA exes while waiting for the installed NvDA to fully exit.

Description of development approach
When the installer starts, it will now first wait an initial 1 second to give time for the installed NVDA to exit from the UAC screen.
When trying to remove each of the NvDA exes, the installer will again try up to 6 times, waiting half a second before the next try. Again, giving much more chance for an installed NvDA to fully exit like it used to.
NVDA will always clean up the temporary files it created while trying to remove all of the exes, whether or not it resulted in a retryableFailure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Many users reported that the upgrade process failed because files could not be replaced and caused NVDA corruption.