voice icon indicating copy to clipboard operation
voice copied to clipboard

RangeError: Maximum call stack size exceeded

Open punjasin opened this issue 6 years ago • 10 comments

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

punjasin avatar Mar 10 '20 11:03 punjasin

IMG_B624AAB12B5C-1

punjasin avatar Mar 10 '20 11:03 punjasin

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

Gamal-Khaled avatar Mar 11 '20 12:03 Gamal-Khaled

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

safaiyeh avatar Mar 11 '20 15:03 safaiyeh

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

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

ts-ign0re avatar Mar 13 '20 12:03 ts-ign0re

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

thtRajasthaniGuy avatar Mar 17 '20 11:03 thtRajasthaniGuy

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

rvonzimmerman avatar Mar 18 '20 00:03 rvonzimmerman

I solve it by downgrade the library to the previous one

punjasin avatar Mar 18 '20 14:03 punjasin

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

boulgom avatar Mar 18 '20 22:03 boulgom

Fix released with 1.1.3

safaiyeh avatar Mar 19 '20 14:03 safaiyeh

Thanks @safaiyeh Would try out the new update

theafolayan avatar Apr 12 '20 12:04 theafolayan