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

text style navigation: Severe freeze when using UIA in MS Word and no next or previous style has been found #16546

Closed
Adriani90 opened this issue May 14, 2024 · 10 comments
Labels
p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@Adriani90
Copy link
Collaborator

Adriani90 commented May 14, 2024

Steps to reproduce:

  1. Open NVDA
  2. Assign [ and shift+[ for different style navigation
  3. Assign ] and shift+] for same style navigation
  4. Open an MS Word document with different text styles, see attached document for a test case.
  5. Make sure UIA for MS Word is enabled in NVDA advanced settings
  6. Navigate to a page with some text, e.g. start on page 2 or 3
  7. Press multiple times the assigned commands for navigating to next and previous text styles.

Actual behavior:

NVDA freezes for at least 10 seconds and keyboard is locked when no next or no previous style has been found, following is written to the log:

IO - inputCore.InputManager.executeGesture (07:16:19.270) - winInputHook (25672):
Input: kb(laptop):upArrow
IO - speech.speech.speak (07:16:19.290) - MainThread (25968):
Speaking ['von AV-\r']
DEBUG - UIAHandler.shouldUseUIAInMSWord (07:16:19.334) - MainThread (25968):
Using UIA due to suitable Office version: (16, 0, 17531)
IO - inputCore.InputManager.executeGesture (07:16:20.670) - winInputHook (25672):
Input: kb(laptop):plus
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (07:16:21.185) - watchdog (29136):
Potential freeze, waiting up to 10 seconds.
IO - inputCore.InputManager.executeGesture (07:16:21.929) - winInputHook (25672):
Input: kb(laptop):upArrow
DEBUG - NVDAObjects.UIA.UIATextInfo._getTextWithFieldsForUIARange (07:16:29.190) - MainThread (25968):
Detected embedded child
INFO - watchdog.waitForFreezeRecovery (07:16:30.696) - watchdog (29136):
Starting freeze recovery after 10.011169499950483 seconds.
DEBUGWARNING - watchdog.waitForFreezeRecovery (07:16:30.696) - watchdog (29136):
Listing stacks for Python threads:
Python stack for thread 10340 (synthDrivers._espeak.BgThread):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "synthDrivers\_espeak.pyc", line 201, in run
  File "queue.pyc", line 171, in get
  File "threading.pyc", line 327, in wait

Python stack for thread 30256 (watchdog.CancellableCallThread.execute(<_FuncPtr object at 0x095433F0>)):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "watchdog.pyc", line 382, in run
  File "threading.pyc", line 629, in wait
  File "threading.pyc", line 327, in wait

Python stack for thread 14712 (visionEnhancementProviders.NVDAHighlighter.NVDAHighlighter):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "visionEnhancementProviders\NVDAHighlighter.pyc", line 452, in _run
  File "winUser.pyc", line 460, in getMessage

Python stack for thread 29136 (watchdog):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "watchdog.pyc", line 159, in _watcher
  File "watchdog.pyc", line 166, in waitForFreezeRecovery
  File "logHandler.pyc", line 64, in getFormattedStacksForAllThreads

Python stack for thread 25672 (winInputHook):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "winInputHook.pyc", line 81, in hookThreadFunc

Python stack for thread 10304 (UIAHandler.UIAHandler.MTAThread):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "UIAHandler\__init__.pyc", line 544, in MTAThreadFunc
  File "queue.pyc", line 171, in get
  File "threading.pyc", line 327, in wait

Python stack for thread 23052 (ThreadPoolExecutor-0_0):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "concurrent\futures\thread.pyc", line 81, in _worker

Python stack for thread 21128 (hwIo.ioThread.IoThread):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "hwIo\ioThread.pyc", line 258, in run

Python stack for thread 25968 (MainThread):
  File "nvda.pyw", line 415, in <module>
  File "core.pyc", line 919, in main
  File "wx\core.pyc", line 2262, in MainLoop
  File "wx\core.pyc", line 3427, in <lambda>
  File "core.pyc", line 849, in processRequest
  File "core.pyc", line 865, in Notify
  File "queueHandler.pyc", line 97, in pumpAll
  File "queueHandler.pyc", line 64, in flushQueue
  File "scriptHandler.pyc", line 243, in _queueScriptCallback
  File "keyboardHandler.pyc", line 571, in executeScript
  File "inputCore.pyc", line 224, in executeScript
  File "scriptHandler.pyc", line 295, in executeScript
  File "browseMode.pyc", line 558, in <lambda>
  File "browseMode.pyc", line 516, in _quickNavScript
  File "browseMode.pyc", line 2431, in _iterTextStyle
  File "browseMode.pyc", line 2224, in _extractStyles
  File "treeInterceptorHandler.pyc", line 255, in getTextWithFields
  File "NVDAObjects\UIA\wordDocument.pyc", line 315, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 877, in getTextWithFields
  File "NVDAObjects\UIA\__init__.pyc", line 865, in _getTextWithFieldsForUIARange
  File "NVDAObjects\UIA\__init__.pyc", line 616, in _getTextWithFields_text
  File "UIAHandler\utils.pyc", line 131, in iterUIARangeByUnit

IO - speech.speech.speak (07:16:33.181) - MainThread (25968):
Speaking ['No next same style text']
IO - speech.speech.speak (07:16:33.200) - MainThread (25968):
Speaking ['42\r']
INFO - watchdog.waitForFreezeRecovery (07:16:33.233) - watchdog (29136):
Recovered from freeze after 12.548535000067204 seconds.
DEBUG - UIAHandler.shouldUseUIAInMSWord (07:16:33.235) - MainThread (25968):
Using UIA due to suitable Office version: (16, 0, 17531)

No previous style:

IO - inputCore.InputManager.executeGesture (07:22:18.409) - winInputHook (25672):
Input: kb(laptop):shift+plus
DEBUGWARNING - RPC process 11884 (WINWORD.EXE) (07:22:23.279) - Dummy-6 (20508):
Thread 4784, build\x86_64\remote\winword.cpp, getSectionBreakType, 830:
error getting section count. There should be exactly 2 sections, count: 1

IO - inputCore.InputManager.executeGesture (07:22:26.254) - winInputHook (25672):
Input: kb(laptop):upArrow
INFO - watchdog.waitForFreezeRecovery (07:22:27.507) - watchdog (29136):
Starting freeze recovery after 10.009615799877793 seconds.
DEBUGWARNING - watchdog.waitForFreezeRecovery (07:22:27.507) - watchdog (29136):
Listing stacks for Python threads:
Python stack for thread 2064 (synthDrivers._espeak.BgThread):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "synthDrivers\_espeak.pyc", line 201, in run
  File "queue.pyc", line 171, in get
  File "threading.pyc", line 327, in wait

Python stack for thread 30256 (watchdog.CancellableCallThread.execute(<CFunctionType object at 0x05F7B300>)):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "watchdog.pyc", line 382, in run
  File "threading.pyc", line 629, in wait
  File "threading.pyc", line 327, in wait

Python stack for thread 14712 (visionEnhancementProviders.NVDAHighlighter.NVDAHighlighter):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "visionEnhancementProviders\NVDAHighlighter.pyc", line 452, in _run
  File "winUser.pyc", line 460, in getMessage

Python stack for thread 29136 (watchdog):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "watchdog.pyc", line 159, in _watcher
  File "watchdog.pyc", line 166, in waitForFreezeRecovery
  File "logHandler.pyc", line 64, in getFormattedStacksForAllThreads

Python stack for thread 25672 (winInputHook):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "winInputHook.pyc", line 81, in hookThreadFunc

Python stack for thread 10304 (UIAHandler.UIAHandler.MTAThread):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "UIAHandler\__init__.pyc", line 544, in MTAThreadFunc
  File "queue.pyc", line 171, in get
  File "threading.pyc", line 327, in wait

Python stack for thread 23052 (ThreadPoolExecutor-0_0):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "concurrent\futures\thread.pyc", line 81, in _worker

Python stack for thread 21128 (hwIo.ioThread.IoThread):
  File "threading.pyc", line 1002, in _bootstrap
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "hwIo\ioThread.pyc", line 258, in run

Python stack for thread 25968 (MainThread):
  File "nvda.pyw", line 415, in <module>
  File "core.pyc", line 919, in main
  File "wx\core.pyc", line 2262, in MainLoop
  File "wx\core.pyc", line 3427, in <lambda>
  File "core.pyc", line 849, in processRequest
  File "core.pyc", line 865, in Notify
  File "queueHandler.pyc", line 97, in pumpAll
  File "queueHandler.pyc", line 64, in flushQueue
  File "scriptHandler.pyc", line 243, in _queueScriptCallback
  File "keyboardHandler.pyc", line 571, in executeScript
  File "inputCore.pyc", line 224, in executeScript
  File "scriptHandler.pyc", line 295, in executeScript
  File "browseMode.pyc", line 558, in <lambda>
  File "browseMode.pyc", line 516, in _quickNavScript
  File "browseMode.pyc", line 2431, in _iterTextStyle
  File "browseMode.pyc", line 2224, in _extractStyles
  File "treeInterceptorHandler.pyc", line 255, in getTextWithFields
  File "NVDAObjects\window\winword.pyc", line 807, in getTextWithFields

DEBUGWARNING - scriptHandler.executeScript (07:22:27.963) - MainThread (25968):
error executing script: <bound method BrowseModeTreeInterceptor.addQuickNav.<locals>.<lambda> of <NVDAObjects.window.winword.WordDocumentTreeInterceptor object at 0x095CAF50>> with gesture 'plus'
Traceback (most recent call last):
  File "scriptHandler.pyc", line 295, in executeScript
  File "browseMode.pyc", line 558, in <lambda>
  File "browseMode.pyc", line 516, in _quickNavScript
  File "browseMode.pyc", line 2431, in _iterTextStyle
  File "browseMode.pyc", line 2224, in _extractStyles
  File "treeInterceptorHandler.pyc", line 255, in getTextWithFields
  File "NVDAObjects\window\winword.pyc", line 789, in getTextWithFields
  File "baseObject.pyc", line 41, in __get__
  File "NVDAObjects\window\winword.pyc", line 1037, in _get_isCollapsed
  File "monkeyPatches\comtypesMonkeyPatches.pyc", line 86, in new__getattr__
  File "comtypes\client\lazybind.pyc", line 168, in __getattr__
  File "comtypes\automation.pyc", line 807, in _invoke
  File "monkeyPatches\comtypesMonkeyPatches.pyc", line 38, in __call__
exceptions.CallCancelled: COM call cancelled
DEBUG - UIAHandler.shouldUseUIAInMSWord (07:22:27.966) - MainThread (25968):
Using UIA due to suitable Office version: (16, 0, 17531)
INFO - watchdog.waitForFreezeRecovery (07:22:28.013) - watchdog (29136):
Recovered from freeze after 10.515615799929947 seconds.
DEBUG - watchdog._waitUntilNormalCoreAliveTimeout (07:22:28.479) - watchdog (29136):
Potential freeze, waiting up to 10 seconds.
IO - speech.speech.speak (07:22:30.389) - MainThread (25968):
Speaking ['No previous same style text']

Expected behavior:

No freeze when no next or previous styles have been found.

NVDA logs, crash dumps and other attachments:

n/a

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

alpha-31919,383b2044 (2024.3.0.31919)

Windows version:

Windows 11 23 H2

Name and version of other software in use when reproducing the issue:

MS Office Word 365 MSO (Version 2403 Build 16.0.17425.20176) 64 Bit

Other information about your system:

Asus ROG Strix Intel I12900HK 5 ghz, 32gb DDR, Grafics NVIDIA GTX 3070TI 8 GB dedicated storage.

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 add-ons in use

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

yes
ONKYO.docx

@Adriani90
Copy link
Collaborator Author

cc: @mltony, @seanbudd probably related to #16436 and may be solved in a similar way like done in #16450.

@mltony
Copy link
Contributor

mltony commented May 18, 2024

Not sure iif anything can be done here - it appears that TextInfo implementation in MSWord is just that slow. As always an option would be to completely disable style navigation in MSWord even when UIA enabled.

@seanbudd
Copy link
Member

Yes, I think at this stage please disable style navigation in MS Word. #16214 may make creating a faster method possible in future

@seanbudd seanbudd added p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation. labels May 20, 2024
@cary-rowen
Copy link
Contributor

this is really bad news, to me style navigation is used even more frequently in MS Word than in a web browser.

@CyrilleB79
Copy link
Collaborator

The following is a comment more general that has a broader scope than only the current issue.

It seems that many advanced navigation features have been disabled due to corner case issues.

I'd suggest to add at least a feature flag controlling enabling/disabling the problematic cases of advanced nav features with the following values:

  • Enabled: All advanced nav feature are enabled as soon as they can work in some case. It's the responsibility of the user not to use them in problematic cases, e.g. big Word documents, etc.
  • When suitable: as recommended by NV Access; i.e. disabled in cases causing freezes or other issues.
  • Default (When suitable)

Since enabling all advanced navigation features can lead to undesirable effects such as freeze or feature not working in some specific cases, the flag should be located in Advanced Settings panel.

@Adriani90
Copy link
Collaborator Author

@CyrilleB79

It seems that many advanced navigation features have been disabled due to corner case issues.

What are corner case issues in your opinion?
Note that the navigation features which have been disabled were disabled because they don't really work. So if @mltony or anyone else can provide solutions to the issues identified, there nothing speaking against re-enabling them.

I'd suggest to add at least a feature flag controlling enabling/disabling the problematic cases of advanced nav features with the following values

I strongly disagree with this approach. This would just give enough confort in just letting the feature buggy as it is in certain cases just because people can turn it on or off. The feature flag has blown up NVDA with features that introduce problems when enabling or disabling them. And no one removes the feature flags when they are not needed anymore. Moreover, old and well tested feature flags are still part of the GUI, See for example the WASAPI feature flag, the annotations feature flags etc. This makes investigation very complicated in my view, when users come up with problems.
I rather think it is better to disable a feature all together in the cases where it doesn't work. And people should rather look for a solution which leads to re-enabling it, rather than doing the soft policy of letting buggy features in NVDA untouched for years.

@Adriani90
Copy link
Collaborator Author

Speaking specifically about text style navigation, we are talking about a script that can be assigned or unassigned. We are not talking about a setting. So this wouldn't fit into such a feature flag environment anyway.

@CyrilleB79
Copy link
Collaborator

OK @Adriani90, what you write about introducing whole and well tested features makes sense and I finally agree with you. You've convinced me.

makes sense

@seanbudd
Copy link
Member

@cary-rowen - I wouldn't be too worried. it's likely in future more optimized methods will be possible. We just can't ship this as-is in 2024.2.

@cary-rowen
Copy link
Contributor

@seanbudd
Yes, I hope #16214 can bring us good news.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
Development

No branches or pull requests

5 participants