-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
Fast Diff Match Patch crashes and the calling thread deadlocks when astral characters are printed in Windows Terminal #16027
Comments
See also #15850 |
cc: @codeofdusk |
This was introduced in JoshData/fast_diff_match_patch@06a9f4e. While this is an improvement in some cases for our purposes this clearly classifies as a regression. It seems fix from the Fast Diff Match Patch developer is quite unlikely, they stated in JoshData/fast_diff_match_patch#27 and JoshData/fast_diff_match_patch#26, that they're no longer actively maintaining the project. Has it been considered to use the version of diff match patch written in pure Python? |
@nstockton Thanks for getting to the bottom of this! I'll look more into it soon. |
No problem. Thanks for all your work with windows terminal accessibility. It made my transition from Legacy console fairly painless when I finally started using Windows terminal. |
Fixes nvaccess#16027 Reverts nvaccess#15514 This reverts commit 69a16cc. Summary of the issue: PR nvaccess#15514 upgraded diff_match_patch from 1.0.2 to fast_diff_match_patch 2.0.1. However, the newer version cannot handle particular unicode characters such as 🍰. The diff_match_patch process dies, NvDA can no longer report text changes, and NvDA hangs on exit. Description of user facing changes Printing unicode characters such as 🍰 in a terminal withn using diff_match_patch for speaking changes no longer causes NvDA to no longer report text changes and lock up on exit. Description of development approach Downgrade back to diff_match_patch 1.0.2.
Follow up to #16027 Fixes #15850 Summary of the issue: Diff Match Patch proxy crashes and the calling thread deadlocks Description of user facing changes Diff Match Patch proxy will become more stable Description of development approach Refactored DiffMatchPatch diff handler. Now, when reading from stdout of a proxy process, if not enough bytes are read, the return code is checked. If a return code was received, an exception is raised and a fallback to difflib occurs.
Follow up to nvaccess#16027 Fixes nvaccess#15850 Summary of the issue: Diff Match Patch proxy crashes and the calling thread deadlocks Description of user facing changes Diff Match Patch proxy will become more stable Description of development approach Refactored DiffMatchPatch diff handler. Now, when reading from stdout of a proxy process, if not enough bytes are read, the return code is checked. If a return code was received, an exception is raised and a fallback to difflib occurs.
Steps to reproduce:
Actual behavior:
If running a recent build of NVDA that uses the Fast Diff Match Patch library:
Expected behavior:
if 'Include Unicode Consortium data is enabled in NVDA speech settings, the name of the emoji "Shortcake" should be spoken. If not, NVDA should not speak the name of the character. Either way, NVDA should be sanitizing the text before sending it to the nvda_dmp.exe process to prevent it from crashing, and to insure continued automatic speech output in terminal windows.
NVDA logs, crash dumps and other attachments:
dmp_fixer.nvda-addon.zip
System configuration
NVDA installed/portable/running from source:
installed
NVDA version:
2024.1beta2 (2024.1.0.30416)
Windows version:
Windows 11, version 23H2
Name and version of other software in use when reproducing the issue:
Windows Terminal, Version 1.18.3181.0
Other information about your system:
Not applicable.
Other questions
Does the issue still occur after restarting your computer?
yes if another astral character is printed to the terminal, or any window who's overlay class inherits from NVDAObjects.behaviors.LiveText.
Have you tried any other versions of NVDA? If so, please report their behaviors.
Bug is applicable to versions of NVDA that use Fast Diff Match Patch.
If NVDA add-ons are disabled, is your problem still occurring?
Not applicable.
Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?
Not applicable.
Some background
The Fast Diff Match Patch ReadMe says:
Some Emoji characters (not all) fall outside of the Basic Multilingual Plane, in the so-called Astral Plane. Unfortunately, some console applications such as the Black formatter for Python output Emoji characters to the console, and in the case of Black, don't have the ability to disable this functionality.
When a recent build of NVDA which makes use of the new Fast Diff Match Patch library tries to automatically speak a character in the astral plane, the nvda_dmp.exe process terminates with an exception, and the NVDA thread that called nvda_dmp.exe is left blocking while it waits for the output of nvda_dmp.exe, which of course it will never receive. Because of the thread becoming deadlocked in this way, no log output is emitted, making the source of the issue tricky to track down.
I created an NVDA add-on that patches classes which inherit from NVDAObjects.behaviors.LiveText, in order to sanitize strings before Fast Diff Match Patch receives them and prevent nvda_dmp.exe from terminating unexpectedly. The add-on will speak astral character names if the user has enabled the 'Include Unicode Consortium data in the NVDA speech settings panel, otherwise it will omit speaking the character name, for consistency with how emoji and other unicode characters in the Basic Multilingual Plane are currently spoken. I've attached the add-on above, but a fix should really be integrated into NVDA its self, as this is an issue which affects NVDA's usage with at least one common CLI-based tool (I.E. Black) and probably several others.
The text was updated successfully, but these errors were encountered: