Skip to content

Fix occasional freeze in 32 bit sapi synths when cancelling speech#19609

Merged
seanbudd merged 1 commit into
betafrom
i19594
Feb 13, 2026
Merged

Fix occasional freeze in 32 bit sapi synths when cancelling speech#19609
seanbudd merged 1 commit into
betafrom
i19594

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #19594

Summary of the issue:

With the introduction of 32 bit sapi support in pr #19432, an occasional freeze may be seen when using 32 bit sapi synths. Specifically when cancelling speech at the same time a speech utterance was finishing.
NVDA would freeze in its call to synth.cancel and the synthDriver process would freeze when calling the synthIndexReached or synthDoneSpeaking callbacks.
This seems to be related to RPYC issue #345, where if a remote call is being made on one thread, but another thread is also moving a remote call and or somehow serving or polling the connection, the second thread may accidentally read and eat the return of the call in the first thread, thus causing the call on the first thread to time out.

Description of user facing changes:

Description of developer facing changes:

Description of development approach:

  • the synthDriver process now makes all synthIndexReached and synthDoneSpeaking notification calls back to NvDA asynchronicely, rather than blocking. This ensures that the synth driver process is now no longer waiting on the connection for these returns, greatly reducing the chance of a freeze, as now all blocking calls should only be coming in from NVDA, not going out.

Testing strategy:

  • General smoke testing of sapi4.
  • Artificial testing by adding a time.sleep to the synth notificaiton callback on the NVDA side, to make the bug more likely, and ensure that with the fix the bug is still gone.

Known issues with pull request:

None known.

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.

…ons in NVDA asynchronisly. This works around a bug in RPYC (RPYC issue #345) where if making a remote call on one thread and then another on a second thread, the second may eat the return of the first causing it to time out. Plus we don't need the return or need to wait anyway.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes an occasional freeze that could occur when using 32-bit SAPI synthesizers (introduced in PR #19432). The freeze happened when speech was cancelled at the same time a speech utterance was finishing, causing NVDA to hang in the synth.cancel call.

Changes:

  • Modified notification callbacks in the synthDriver service to be asynchronous, preventing the synthDriver process from blocking while waiting for callback returns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@seanbudd seanbudd added this to the 2026.1 milestone Feb 13, 2026
@seanbudd seanbudd merged commit c37b942 into beta Feb 13, 2026
75 of 81 checks passed
@seanbudd seanbudd deleted the i19594 branch February 13, 2026 06:23
seanbudd pushed a commit that referenced this pull request May 25, 2026
…026.2 as it is not stable enough yet. (#20206)

Fixes #19667
Fixes #19819
Reverts #19672
Summary of the issue:

Experimental code was recently added to NVDA (after 2026.1) that caused the 32 bit synthDriver shim to send its audio back to NvDA for playing, rather than playing it directly in its own process. This was done to test / prepare for the time when add-ons would be running in an app container, and therefore probably would not have direct access to the audio device.
However, currently this code is still quite unstable, causing NVDA to freeze when rapidly changing the speech rate, or arrowing up and down in lists, when using sapi4 or 32 bit sapi5.
This instability is most likely a similar issue to what was fixed in pr #19609, where RPYC is handoing the return of a call on the wrong thread. But in this case, it is calls to/from nvwave in NVDA's process.
Description of user facing changes:
Description of developer facing changes:
Description of development approach:

    Simply instruct the synthDriver process not to install the nvwave proxy that brokers back to NvDA.
    Reverts Re-enable audio ducking for proxied x86 speech synths #19672 so that 32 bit synthDrivers suspend audioDucking while they are running, as audioDucking cnanot be supported without brokering audio.
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.

3 participants