grpc-node: Unhandled 'error' event crash
While using nodejs-speech I am facing crashes like the one shown here:
events.js:183
throw er; // Unhandled 'error' event
^
Error: 14 UNAVAILABLE: EOF
at createStatusError (/service/node_modules/grpc/src/client.js:64:15)
at ClientDuplexStream._emitStatusIfDone (/service/node_modules/grpc/src/client.js:270:19)
at ClientDuplexStream._receiveStatus (/service/node_modules/grpc/src/client.js:248:8)
at /service/node_modules/grpc/src/client.js:804:12
The Error code and message varies from crash to crash. Ie:
Error: 14 UNAVAILABLE: 502:Bad Gateway
…, but the crash stack trace is always the same. client.js
is emiting an error
event on an instance that does not have any listener for such event attached.
I opened the corresponding issue in in nodejs-speech https://github.com/googleapis/nodejs-speech/issues/62, but I believe this is the correct place for it.
It is reproducible even though it can take from 1 minute to almost 2 hours to happen. I can provide with the required information, some of which you can already see in the referenced issue.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 17 (7 by maintainers)
No clue on how google-gax and nodejs-speech are working exactly - gRPC itself is issuing call objects when being asked to, and whichever is requesting them HAS to bind the error handler on them.
So something somewhere along the chain is breaking that API contract.
Hi @kjin,
For how much time did you try? It is sometimes easily reproducible, whereas the same piece of code may not crash that easily on a later execution… I’ve sometime got the crash within a minute or two, some other each 5 minutes and some other time 3 hours after starting… I wish I had a 100% reproducible code snippet.
I’m getting a real time audio stream from a gstreamer pipe (gst-launch), out of which I’m creating a readable Node.js stream, which I’m piping to the google-speech
streamingRecognize()
duplex stream.If you check the code I provided, the class has a method
start()
which expects a readable stream: https://github.com/googleapis/nodejs-speech/issues/62#issue-317169484As I said, and if you read the whole google-speech issue you will notice, I would reproduce it every 5 minutes for some time…, but then the crash didn’t appear until 80+ minutes of continuous execution.
In case it helps, here the logs of one of the latest time the process crashed last week. I put a log on every event handler of the duplex stream, consisting of a random ID and an counter. Everytime I create a
streamingRecognize()
duplex stream I assign it an incrementing numerical attribute which I use later for logging purposes.I use the
unpipe
event handler to create a new duplex stream which I then pipe to the audio read stream. Theunpipe
event is usually fired uponerror
event as can be seen.NOTE: the crash logs are at the very end