Skip to content

Google-cloud/speech emitting close event after short period of inactivity #2105

Closed

Description

@shekit

Environment details

  • 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

  1. 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.
  2. Clone repo - https://github.com/shekit/electron-voice
  3. npm install -g [email protected]
  4. npm install --save nan
  5. HOME=~/.electron-gyp npm install in project folder
  6. Place google speech keyfile.json in project folder
  7. electron main.js (from project folder)
  8. Say 'snowboy' followed by a command

The Issue

  1. 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.
  2. 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.
  3. 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.

Thanks!

Activity

  1. lukesneeringer commented on Mar 20, 2017

    @lukesneeringer
    Contributor

    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.

  2. shekit commented on Mar 20, 2017

    @shekit
    Author

    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.

  3. added
    type: questionRequest for information or clarification. Not an issue.
    on Mar 21, 2017
  4. stephenplusplus commented on May 17, 2017

    @stephenplusplus
    Contributor

    @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.

  5. removed
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: speechIssues related to the Speech-to-Text API.electrontype: questionRequest for information or clarification. Not an issue.web

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions