You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Google-cloud/speech emitting close event after short period of inactivity #2105
OS: Raspbian Jessie(with Pixel) & Mac OSX 10.11.4 (same issue on both)
Node.js version: 6.10.0
npm version: 3.10.10
google-cloud-node version: 0.7.0 (using only google-speech)
Electron Version: 1.6.2
Steps to reproduce
I've written an electron app that streams from the mic input to google speech on a hotword being detected which can be found in this file https://github.com/shekit/electron-voice.
HOME=~/.electron-gyp npm install in project folder
Place google speech keyfile.json in project folder
electron main.js (from project folder)
Say 'snowboy' followed by a command
The Issue
After a small period of inactivity if I speak something, I immediately receive the close event from the google detector and it doesn't transcribe anything. If I trigger it again, it transcribes successfully.
I only receive this close event after a short period of inactivity which I have found to be consistently ~4 minutes, but no error is triggered.
I'm explicitly calling mic.unpipe(googlestream) and googlestream.end() after I receive the final transcribed results. single_utterance is set to true.
Any idea why this would be happening? This does not seem to be a timeout error as I am listening for error events emitted by the google stream and no errors are being emitted.
Hi @shekit; thanks for reporting this.
My understanding was that the Speech API does close the connection after some time, so this might be intended behavior. I will attempt to find out.
For what it is worth, I do think there is a pretty good case to be made for closing the connection after a few minutes of inactivity. After all, consider the case where we do not close a connection and someone inadvertently leaves one open and then gets a huge bill from us.
Hey @lukesneeringer, thanks for the response! I don't think that is the issue though. When I don't close the stream, google automatically sends me an error message around the 60 sec mark saying the maximum permissible limit is 65 seconds and closes the connection, which makes sense as it is indicated as the permissible streaming content limit in the docs.
So I began to explicitly close the google stream connection by causing .end() on it and I no longer receive that error around the 60 sec mark. However it does silently close(with no error) if I open another new connection and make a request after 4 mins.
If on the other hand, I continue making requests, as long as they are made within that 4 min mark, even if it is at 3 mins 50 seconds then I can keep it running forever.
@shekit Sorry for the delay in our investigation. Thank you for your patience. Since this issue got a bit stale, I wondered if you're still having problems or have found any solutions? I will dive in and follow the reproduction steps above, I just want to be sure you're still having these issues.
Activity
lukesneeringer commentedon Mar 20, 2017
Hi @shekit; thanks for reporting this.
My understanding was that the Speech API does close the connection after some time, so this might be intended behavior. I will attempt to find out.
For what it is worth, I do think there is a pretty good case to be made for closing the connection after a few minutes of inactivity. After all, consider the case where we do not close a connection and someone inadvertently leaves one open and then gets a huge bill from us.
shekit commentedon Mar 20, 2017
Hey @lukesneeringer, thanks for the response! I don't think that is the issue though. When I don't close the stream, google automatically sends me an error message around the 60 sec mark saying the maximum permissible limit is 65 seconds and closes the connection, which makes sense as it is indicated as the permissible streaming content limit in the docs.
So I began to explicitly close the google stream connection by causing .end() on it and I no longer receive that error around the 60 sec mark. However it does silently close(with no error) if I open another new connection and make a request after 4 mins.
If on the other hand, I continue making requests, as long as they are made within that 4 min mark, even if it is at 3 mins 50 seconds then I can keep it running forever.
stephenplusplus commentedon May 17, 2017
@shekit Sorry for the delay in our investigation. Thank you for your patience. Since this issue got a bit stale, I wondered if you're still having problems or have found any solutions? I will dive in and follow the reproduction steps above, I just want to be sure you're still having these issues.
feat: implement parallel operations (#2067) (#2109)
observability: ensure that each span has otel.scope.name,version (#2105)
fix(deps): update all dependencies (#2105)
feat: implement parallel operations (googleapis#2067) (googleapis#2109)
fix(deps): update all dependencies (#2105)