nodejs-speech icon indicating copy to clipboard operation
nodejs-speech copied to clipboard

Issue with infinite streaming errors DEADLINE_EXCEEDED after 1 minute

Open dweberlj opened this issue 7 years ago • 10 comments

Hello,

I am having an issue with the infiniteStreaming.js example where after 1 minute of execution it errors with DEADLINE_EXCEEDED. See screenshot below. Since I had difficulties using the Sox microphone on Windows, I changed the infiniteStreaming.js code to stream a local WAV file to the Google engine. The transcription from Google works great but only for 1 minute. You can see in the console window that I display the start time and the time when it errors which is 1 min.

image

Here is the modified infiniteStreaming.js code, I simply commented out the recorder code and replaced it with fs.createReadStream

image

For the audio input file I created a new WAV file using the /resources/commercial_mono.wav file and repeated it several times to get 22 minutes of audio.

Any help would be greatly appreciated.

Thanks, Dean longaudiosample.zip

dweberlj avatar Oct 29 '19 00:10 dweberlj

@callmehiphop I know you were helping folks earlier with a similar question related to long-lived requests on PubSub, is there a configuration setting that @dweberlj should be setting (or is this potentially a bug we should be addressing?)

bcoe avatar Oct 29 '19 01:10 bcoe

@bcoe sounds like @dweberlj is hitting the pre-configured deadline, it would be great if gax allowed us to opt out of setting a deadline entirely, but since that isn't an option I think the best solution here would be to manually increase the deadline.

const stream = client.streamingRecognize(request, {
  timeout: 60000 * 5 // or longer if necessary..
});

callmehiphop avatar Oct 29 '19 19:10 callmehiphop

I just ran into this issue today also. Given that the limit was changed to 5 mins for v1p1beta1 on June 18/2019 (see https://cloud.google.com/speech-to-text/docs/release-notes), is there a reason to not just change the value in the config file to 300000 (5 mins in milliseconds)?

I manually changed my local file and I can confirm that the infiniteStreaming.js example works as expected with that one change.

pvaillant avatar Oct 30 '19 03:10 pvaillant

Those files are generated so any manual edits we make will just get reverted, we would need some one on the API team to chime in here.

I think we just need to make an amendment or two to the sample to make sure that the stream doesn't timeout like this.

callmehiphop avatar Oct 30 '19 06:10 callmehiphop

I also confirmed that the streaming timeout limit is 5 min (305 seconds). See below error message and stack dump. I agree that the infiniteStreaming example should be amended to automatically restart the stream on the timeout, and ideally have the streamingRecognize() API modified to support long / unlimited streams.

image

image

dweberlj avatar Oct 30 '19 13:10 dweberlj

As @callmehiphop suggested:

const stream = client.streamingRecognize(request, {
  timeout: 60000 * 5 // or longer if necessary..
});

Unfortunately, this didn't work out for me. Amending the original infiniteStreaming.js with this small change still gets me DEADLINE_EXCEEDED.

petrnetusil avatar Nov 10 '19 21:11 petrnetusil

@callmehiphop I tried the same and it didn't work.

The only way to get past 1 minute is to update the @google-cloud\speech\src\v1p1beta1\speech_client_config.json timeout_millis values to (60000*5) for 5 minutes.

This is highly inadvisable and was only done to validate the limits in a test scenario. I believe the only fix is up to the Google API team at this point. Any suggestions would be greatly appreciated.

dweberlj avatar Nov 11 '19 00:11 dweberlj

@callmehiphop @alexander-fenster @xiaozhenliu-gg5, I wonder if this might actually be a change in behavior when we moved from grpc to @grpc/grpc-js.

I believe the idea of the infinite streaming example is that, in application code, it times out requests before the gRPC timeout is raised, and then resumes where it's left off?

I think it might be worth confirming that this pattern works well with the existing gRPC transport libraries.

bcoe avatar Nov 11 '19 18:11 bcoe

see: https://github.com/googleapis/nodejs-speech/issues/458

bcoe avatar Nov 11 '19 19:11 bcoe

This issue may no longer be relevant so I am closing it. Please reopen if needed.

b-loved-dreamer avatar May 19 '21 22:05 b-loved-dreamer