Google-cloud-node: Speech SDK returns Client GRPC deadline too short

Created on 21 Dec 2016  路  13Comments  路  Source: googleapis/google-cloud-node

Hi,

Sometime the speech nodejs SDK returns the following error:

Client GRPC deadline too short. Should be at least: 3 * audio-duration + 5 seconds. Current deadline is: 59.99929095065454 second(s). Required at least: 61 second(s).

And the audio stream is destroyed after that:

stream was destroyed","stack":"Error: stream was destroyed\n at /root/sip.rogervoice.com/speech_recognition/node_modules/pump/index.js:45:21\n at call (/root/sip.rogervoice.com/speech_recognition/node_modules/pump/index.js:50:3)\n at Array.forEach (native)\n at /root/sip.rogervoice.com/speech_recognition/node_modules/pump/index.js:72:16\n at f (/root/sip.rogervoice.com/speech_recognition/node_modules/once/once.js:17:25)\n at /root/sip.rogervoice.com/speech_recognition/node_modules/pump/index.js:31:5\n at f (/root/sip.rogervoice.com/speech_recognition/node_modules/once/once.js:17:25)\n at DestroyableTransform.onfinish (/root/sip.rogervoice.com/speech_recognition/node_modules/pump/node_modules/end-of-stream/index.js:30:18)\n at emitNone (events.js:91:20)\n at DestroyableTransform.emit (events.js:185:7)","level":"error","timestamp":"2016-12-21T11:07:37.170Z

There is no information about this duration on your documentation. I don't know how to change it.

Here how I use the SDK:

createRecognizeStream({
            config: {
                encoding: 'LINEAR16',
                sampleRate: 16000,
        languageCode: 'en-US',
                maxAlternatives: 1,
            profanityFilter: true
            },
            singleUtterance: true,
            interimResults: true,
            verbose: true
})

The audio stream is a continuous realtime stream.

bug speech

Most helpful comment

@stephenplusplus @jmuk do you have any news regarding this issue? This issue cause a lot of problems on our production.

All 13 comments

Thank you for reporting.

@jmuk any ideas?

@stephenplusplus @blerest Same problem!

Hmmm, it seems you are using the streaming method, I'm not sure what's the right way to specify the timeout.

  • The autogen layer allows the timeout through the call options, while the hand-written layer seems not providing the code path. I'll fix the hand-written layer to allow customizing the timeout.
  • I will investigate how the timeout works for streaming method.

@jmuk Yes, I can confirm that recognizeStream drops with the error message randomly, but at least 1 time per minute. I found the workaround by catching 'error' event and recreating the stream, but.....Would love to this to be fixed. Please, keep us posted.

@stephenplusplus @jmuk do you have any news regarding this issue? This issue cause a lot of problems on our production.

There is API limit for the audio length, which is 1 minute for the streaming API call (StreamingRecognize).

https://cloud.google.com/speech/limits#content

@swcloud You are true. This error is throwing when 1 minute of audio is exceeded. Maybe it would be a good idea to change this error message to a more appropriate message?

Second question: do you plan to remove this limite of 1 minute? It is a problem for us as our client can speak more than 1 minute.

(my responses are delayed since I'm on vacation. Sorry!)

Okay, I've noticed that the streamingRecognize will accept up to 60 seconds according to https://cloud.google.com/speech/limits#content

Let's do the following things:

  • increase the default timeout (currently 60 seconds, but probably at least 60 * 3 + 5 = 185 seconds)
  • allow specifying the timeout at the API level

@blerest If your audio length is more than 1 minute, you should make asynchronous request, which has 80-minute limit.

Hello, I'm trying to use the 'listen' mode and after 20 seconds, the stream is destroyed even if the 'isFinal' flag is true or false. Do you have any idea why ?

Thx

Guys, you should have a look at how @jerjou has solved this, here: https://github.com/GoogleCloudPlatform/python-docs-samples/issues/517. Check out his minute_workaround branch in this repository.

Oh wow deja vu - it's like, the same conversations we're having over in python land are being had here in nodejs land too :-)

@damienjars the 20-second limit is probably because of the timeout that jmuk mentioned above - you'll want to set the timeout to 60 * 3 + 5 = 185 seconds to get the full 60 seconds.

Otherwise, the easiest workaround I could think of was to make requests with single_utterance=True, and simply reopen the stream after every utterance (while keeping a small ring buffer of audio so you don't miss any speech between the streams).

This works as long as there isn't more than 60 seconds between utterances. If you anticipate a lot of silences in your audio, I'd imagine you'll need to do some speech detection (or something more manual) before opening up the stream in the first place (again, with the small ring buffer). If you anticipate your speakers to drone on for more than 60 seconds without a break... then maybe you have bigger problems :wink:

My PR #1915 increases the timeout to 190 seconds which should be sufficient to recognize 60 seconds audio. I'm also adding more comments for the audio duration limits, and allow customizing timeout (the problem on google-cloud-node specific is, the current interface doesn't allow timeout customization).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hvolschenk picture hvolschenk  路  4Comments

vvzen picture vvzen  路  4Comments

VikramTiwari picture VikramTiwari  路  3Comments

jgeewax picture jgeewax  路  4Comments

nicolasgarnier picture nicolasgarnier  路  4Comments