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

Assertion failed: reentry detected, value=false, oldValue=true #782

Closed
zepumph opened this issue Feb 24, 2022 · 3 comments
Closed

Assertion failed: reentry detected, value=false, oldValue=true #782

zepumph opened this issue Feb 24, 2022 · 3 comments

Comments

@zepumph
Copy link
Member

zepumph commented Feb 24, 2022

To reproduce, go to Ratio and Proportion, turn on voicing, and then click any readme button many times quickly.

@jessegreenberg, I'm unsure if reentrancy is acceptable, or if we need to guard here. Over to you.

assert.js:25 Uncaught Error: Assertion failed: reentry detected, value=false, oldValue=true
    at window.assertions.assertFunction (assert.js:25:13)
    at BooleanProperty._notifyListeners (Property.ts:286:15)
    at BooleanProperty.set (Property.ts:223:14)
    at VoicingToolbarItem.js? [sm]:185:30
    at TinyEmitter.emit (TinyEmitter.ts:93:9)
    at Emitter.ts:49:24
    at Emitter.execute (Action.ts:251:18)
    at Emitter.emit (Emitter.ts:70:19)
    at VoicingManager.handleSpeechSynthesisEnd (SpeechSynthesisAnnouncer.js? [sm]:413:29)
    at VoicingManager.cancelUtterance (SpeechSynthesisAnnouncer.js? [sm]:461:14)
@jessegreenberg
Copy link
Contributor

jessegreenberg commented Mar 12, 2022

Found the way to consistently produce this. Press a button twice quickly so that you play/stop before the synth begins to speak.

When you press the stop button this way there is no utterance to cancel yet so pressing it does nothing. Then the synth begins to speak from the "play" press a little later. Then the next time you press the button play again we hit this assertion because we are trying to cancel/play the same button which sets the same isPlayingProperty back and forth in the same callback.

I think this is a failure of UtteranceQueue.cancelUtterance, we need to be able to cancel an utterance between when the announcement is requested and when the utterance gets spoken. I think we are set up to do this now actually that we added a reference to a pendingUtterance in phetsims/utterance-queue#66

@jessegreenberg
Copy link
Contributor

I misdiagnosed, this is not caused by phetsims/utterance-queue#66 but by phetsims/utterance-queue#68 and has been fixed via that issue. UtteranceQueue.cancelUtterance did not remove the Utterance from the queue so pressing the "stop" button effectively did nothing if you pressed it before the Utterance made it to the Announcer.

@zepumph assigning to you to review/confirm if you wish otherwise I think this can be closed.

@zepumph
Copy link
Member Author

zepumph commented Mar 14, 2022

Seems fixed to me! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants