Voice: RangeError: Maximum call stack size exceeded

Created on 10 Mar 2020  路  10Comments  路  Source: react-native-voice/voice

Bug

After i upgrade my react-native from 59.9 to 61.5
it crash when onSpeechPartialResult callback
RangeError: Maximum call stack size exceeded

Environment info

System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 59.57 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.19.0 - /usr/local/opt/node@10/bin/node
Yarn: 1.19.0 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/opt/node@10/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 27, 28, 29
Build Tools: 27.0.3, 28.0.3, 29.0.2
System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1

React native info output:

 // paste it here

Library version: 1.1.1

Steps To Reproduce

1.
2.
...

Describe what you expected to happen:

1.toggle speech
2.speech
3.crash

const available = await recogniter.isAvailable();
if (available) {
await recogniter.start(convert);
}

i didn't use onSpeechPartialResult in my code but it crash on library side

Most helpful comment

Ok, I've figured out. You have to add noop handlers for unused methods.
Fox example:

Voice.onSpeechPartialResults = () => null;
Voice.onSpeechRecognized = () => null;

All 10 comments

IMG_B624AAB12B5C-1

Hi @punjasin, I was facing the same issue but with onSpeechVolumeChanged and adding handler to it fixed my problem.

try adding handler for "onSpeechPartialResults" event

Hi @punjasin could you provide a repo that demonstrates the error?

Ok, I've figured out. You have to add noop handlers for unused methods.
Fox example:

Voice.onSpeechPartialResults = () => null;
Voice.onSpeechRecognized = () => null;

@punjasin can you share your code. i don't know how to implement in hooks

I looked at the code a bit, looks like the typescript migration had a few bugs crop up 馃槄
This in particular: https://github.com/react-native-community/voice/pull/235/files#diff-f41e9d04a45c83f3b6f6e630f10117feL15-L21
And then here's where the unset methods will recursively call themselves:
https://github.com/react-native-community/voice/pull/235/files#diff-f41e9d04a45c83f3b6f6e630f10117feL144-L199

I solve it by downgrade the library to the previous one

I have a similar issue but my call stack is flowded by removeAllListeners.
Downgrading to 1.0.6 solved the issue.

Fix released with 1.1.3

Thanks @safaiyeh Would try out the new update

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MrHazimAli picture MrHazimAli  路  7Comments

nikodunk picture nikodunk  路  3Comments

aamping picture aamping  路  6Comments

blackcoudpm picture blackcoudpm  路  8Comments

alvaro1728 picture alvaro1728  路  5Comments