When the JSON cache file in the add-on store is incorrect, starting NVDA afterwards will always restart.
Starting NVDA will always restart when there is a problem with the JSON cache file in the add-on store.
Steps to reproduce:
It is possible to manually change the JSON cache file of the add-on store, breaking its structure.
Actual behavior:
After rebooting, it will keep rebooting for a while. You must delete %appdata%\nvda\addonStore to recover!
Expected behavior:
It won't keep rebooting.
NVDA logs, crash dumps and other attachments:
After this problem occurs during operation, the exception is ignored and NVDA continues to operate normally.
ERROR - logHandler._threadExceptHook (02:23:37.237) - initialiseAvailableAddons (15536):
Exception in thread initialiseAvailableAddons:
Traceback (most recent call last):
File "requests\models.pyc", line 971, in json
File "json\__init__.pyc", line 346, in loads
File "json\decoder.pyc", line 337, in decode
File "json\decoder.pyc", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "threading.pyc", line 1045, in _bootstrap_inner
File "threading.pyc", line 982, in run
File "addonStore\dataManager.pyc", line 208, in getLatestCompatibleAddons
File "addonStore\dataManager.pyc", line 142, in _getCacheHash
File "requests\models.pyc", line 975, in json
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The log after rebooting all the time, omitting the configuration file contents section. It's not there later.
INFO - core.main (02:46:40.653) - MainThread (21408):
Developer Scratchpad mode enabled
INFO - core.main (02:46:41.154) - MainThread (21408):
Windows version: Windows 11 22H2 (10.0.22621) workstation AMD64
INFO - core.main (02:46:41.154) - MainThread (21408):
Using Python version 3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:40:55) [MSC v.1935 32 bit (Intel)]
INFO - core.main (02:46:41.154) - MainThread (21408):
Using comtypes version 1.2.0
INFO - core.main (02:46:41.154) - MainThread (21408):
Using configobj version 5.1.0 with validate version 1.0.1
DEBUG - core.main (02:46:41.154) - MainThread (21408):
Initializing add-ons system
DEBUG - addonStore.dataManager.initialize (02:46:41.164) - MainThread (21408):
initializing addonStore data manager
CRITICAL - __main__ (02:46:41.166) - MainThread (21408):
core failure
Traceback (most recent call last):
File "nvda.pyw", line 415, in <module>
File "core.pyc", line 666, in main
File "addonStore\dataManager.pyc", line 64, in initialize
File "addonStore\dataManager.pyc", line 96, in __init__
File "addonStore\dataManager.pyc", line 195, in _getCachedAddonData
File "addonStore\models\addon.pyc", line 367, in _createStoreCollectionFromJson
File "json\__init__.pyc", line 346, in loads
File "json\decoder.pyc", line 337, in decode
File "json\decoder.pyc", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1619 (char 1618)
DEBUGWARNING - RPC process 9876 (explorer.exe) (02:46:41.791) - Dummy-1 (33556):
Thread 7148, build\x86_64\remote\ia2Support.cpp, IA2Support_inProcess_terminate, 215:
WaitForMultipleObjects returned -1
DEBUGWARNING - RPC process 9876 (explorer.exe) (02:46:41.797) - Dummy-1 (33556):
Thread 7148, build\x86_64\remote\ia2Support.cpp, IA2Support_inProcess_terminate, 215:
WaitForMultipleObjects returned -1
DEBUGWARNING - RPC process 19168 (explorer.exe) (02:46:43.027) - Dummy-1 (33556):
Thread 20968, build\x86_64\remote\ia2Support.cpp, IA2Support_inProcess_terminate, 215:
WaitForMultipleObjects returned -1
ERROR - Exception ignored in atexit callback: <function terminate at 0x04E607A8> (02:46:43.194) - MainThread (21408):
Traceback (most recent call last):
File "audio\soundSplit.pyc", line 96, in terminate
File "audio\soundSplit.pyc", line 160, in setSoundSplitState
File "audio\soundSplit.pyc", line 115, in applyToAllAudioSessions
AttributeError: 'NoneType' object has no attribute 'RegisterSessionNotification'
System configuration
NVDA installed/portable/running from source:
all
NVDA version:
2023.2 and higher (version with add-on store)
Windows version:
all
Name and version of other software in use when reproducing the issue:
Other information about your system:
Other questions
Does the issue still occur after restarting your computer?
yes
Have you tried any other versions of NVDA? If so, please report their behaviors.
no
If NVDA add-ons are disabled, is your problem still occurring?
no
Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?
no
In addition to fixing the problem directly, a new directory of temporary configuration files should be used to start NVDA after multiple reboots of NVDA to prevent a similar situation from causing constant reboots.
Additional Background:
NVDA Chinese Community has implemented a Chinese mirror service for NVDA add-on store to address the issue of inaccessible NVAccess servers or GitHub in China, a crucial step for ensuring accessibility in regions with restricted internet access.
Detailed Event Analysis:
The incident in question arose when the domain name nvdadr.com, associated with the NVDA mirror service, was not renewed upon its expiration. Consequently, the resolution process was temporarily halted, leading to an interruption in the service.
During this period, NVDA continued its attempts to fetch JSON metadata from the mirror URL (https://nvaccess.mirror.nvdadr.com/addonStore/) and cache it. However, due to the domain expiration, the fetched JSON metadata was incorrect, resulting in the following incomplete data:
{"cacheHash": "5879d0a", "data": "<!doctype html>\n<html data-adblockkey=\"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANDrp2lz7AOmADaN8tA50LsWcjLFyQFcb/P2Txc58oYOeILb3vBw7J6f4pamkAQVSQuqYsKx3YzdUHCvbVZvFUsCAwEAAQ==_zfTeKzgCqjN9uqZTaK7N68nBYslcNOtQDa2mIg4BrsRvp3unqjzNDTX1SoB6cxWYqZj619jzIf8NrGkrSCJ1Bw==\" lang=\"en\" style=\"background: #2B2B2B;\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <link rel=\"icon\" href=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC\">\n <link rel=\"preconnect\" href=\"https://www.google.com\" crossorigin>\n</head>\n<body>\n<div id=\"target\" style=\"opacity: 0\"></div>\n<script>window.park = \"eyJ1dWlkIjoiYjBhMmQ4YTAtNDY4YS00NGU3LThkNGQtMTNhYTQ1ZDJjMDhhIiwicGFnZV90aW1lIjoxNzEyMjM1ODkxLCJwYWdlX3VybCI6Imh0dHBzOi8vbnZhY2Nlc3MubWlycm9yLm52ZGFkci5jb20vYWRkb25TdG9yZS9lbi9hbGwvMjAyMy4zLjQuanNvbiIsInBhZ2VfbWV0aG9kIjoiR0VUIiwicGFnZV9yZXF1ZXN0Ijp7fSwicGFnZV9oZWFkZXJzIjp7fSwiaG9zdCI6Im52YWNjZXNzLm1pcnJvci5udmRhZHIuY29tIiwiaXAiOiIyMDMuMjA4LjYxLjkxIn0K\";</script>\n<script src=\"/bWWEMrfqs.js\"></script>\n</body>\n</html>\n", "cachedLanguage": "en", "nvdaAPIVersion": [2023, 3, 4]}
User Impact Assessment:
The incorrect metadata JSON caused NVDA to encounter an error, leading to a continuous restart loop, as outlined in the initial issue description. This error rendered users completely unable to use their computers, significantly impacting their productivity and accessibility.
The following factors may further exacerbate this situation:
- NVDA is configured to start automatically after login.
- Each time NVDA starts, it simulates pressing the Win+U keys, causing a constant shift in focus. This behavior made it challenging to employ alternative screen readers to rectify the issue manually, such as by deleting the erroneous JSON file. This might be worth raising a separate issue.
Recommendations for Future Prevention:
To prevent such incidents from recurring and to enhance the robustness of NVDA, the following recommendations are proposed:
- Enhanced Stability: NVDA should be equipped with improved error handling capabilities to manage unexpected situations more effectively. Specifically, the screen reader should avoid entering a continuous restart loop under any circumstances.
- Service Availability Check: The NVDA mirror add-on should incorporate a service availability check mechanism. This feature should ensure that the add-on operates only when the mirror service is accessible, thereby preventing the retrieval of incorrect metadata.
We see the required solution to clear the cache if there is an issue with parsing the JSON file.
I think this should be a higher priority, this shouldn't be p5 as it causes users' NVDA to restart repeatedly to the point where they can't use their computer.
This problem is very much affecting the user's daily use. It is recommended to change the priority to P1 or P2.
Thanks for the additional feedback everyone. We'll have another look at this one tomorrow.
I agree that this should have a higher priority.
What about using the jsonschema library to validate any JSON file that NVDA reads in core? Any failure should result in the file being deleted.
https://stackoverflow.com/questions/54491156/validate-json-data-using-python
Testers and reviewers, you can see PR #16461 Please test and provide feedback if required, before I mark this as ready for review.