Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Error: 13 INTERNAL: Received RST_STREAM with code 2 #785

Closed
Nakavinsky opened this issue May 29, 2020 · 13 comments
Closed

Error: 13 INTERNAL: Received RST_STREAM with code 2 #785

Nakavinsky opened this issue May 29, 2020 · 13 comments
Labels
api: vision Issues related to the googleapis/nodejs-vision API. external This issue is blocked on a bug with the actual product. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@Nakavinsky
Copy link

Nakavinsky commented May 29, 2020

Yo, I've been having this random error lately, and I have no idea why.

Error: 13 INTERNAL: Received RST_STREAM with code 2

details: 'Received RST_STREAM with code 2',
metadata: Metadata { internalRepr: Map {}, options: {} },
note: 'Exception occurred in retry method that was not classified as transient

Code:

const vision = require('@google-cloud/vision');
const client = new vision.ImageAnnotatorClient({projectId: "...", keyFilename: "....json"});
...
const [result] = await gclient.textDetection(image);
const texts = result.fullTextAnnotation;
console.log(texts)

The image is a remote url.

And thanks in advance.

@product-auto-label product-auto-label bot added the api: vision Issues related to the googleapis/nodejs-vision API. label May 29, 2020
@stephenplusplus
Copy link
Contributor

Could you share your environment details?

  • OS:
  • Node.js version:
  • npm version:
  • @google-cloud/vision version:

How frequently is this happening? Thanks!

@bcoe bcoe added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. needs more info This issue needs more information from the customer to proceed. labels May 29, 2020
@Nakavinsky
Copy link
Author

Yes

  • OS: Windows 10
  • Node.js version: 12.16.3
  • npm version: 6.14.5
  • @google-cloud/vision version: ^1.11.0

It's happening alot.

@asaflevreal
Copy link

I am having same issue as well

@JustinBeckwith JustinBeckwith removed the needs more info This issue needs more information from the customer to proceed. label Jun 16, 2020
@JustinBeckwith
Copy link
Contributor

Making sure @alexander-fenster and @murgatroid99 see this

@Ayelit
Copy link

Ayelit commented Sep 13, 2020

I am having same issue as well.
It happened on Sep 10, 2020.

OS: CentOS Linux release 7.7.1908
Node.js version: 12.16.1
@google-cloud/vision version: 2.1.1

"Error: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error
at Object.callErrorFromStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call.js:31:26
at Object.onReceiveStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/client.js:176:52
at Object.onReceiveStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:342:141
at Object.onReceiveStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:305:181
at Http2CallStream.outputStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call-stream.js:117:74
at Http2CallStream.maybeOutputStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call-stream.js:156:22
at Http2CallStream.endCall (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call-stream.js:142:18
at ClientHttp2Stream. (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call-stream.js:420:22
at ClientHttp2Stream.emit (events.js:311:20
at emitCloseNT (internal/streams/destroy.js:69:8
at emitErrorAndCloseNT (internal/streams/destroy.js:61:3
at processTicksAndRejections .processTicksAndRejections (internal/process/task_queues.js:84:21 undefined)"

We got this error, but also this one around the same time, for another request:

"Error: 8 RESOURCE_EXHAUSTED: Bandwidth exhausted at Object.callErrorFromStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call.js:31:26
at Object.onReceiveStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/client.js:176:52
at Object.onReceiveStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:342:141
at Object.onReceiveStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:305:181
at Http2CallStream.outputStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call-stream.js:117:74
at Http2CallStream.maybeOutputStatus (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call-stream.js:156:22
at Http2CallStream.endCall (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call-stream.js:142:18
at ClientHttp2Stream. (/usr/src/app/webint-enrichment-service/node_modules/@google-cloud/vision/node_modules/@grpc/grpc-js/build/src/call-stream.js:420:22
at ClientHttp2Stream.emit (events.js:311:20
at emitCloseNT (internal/streams/destroy.js:69:8
at emitErrorAndCloseNT (internal/streams/destroy.js:61:3
at processTicksAndRejections .processTicksAndRejections (internal/process/task_queues.js:84:21 undefined)"

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Nov 25, 2020
@munkhuushmgl munkhuushmgl removed the 🚨 This issue needs some love. label Nov 26, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Nov 26, 2020
@Sembiance
Copy link

Sembiance commented Jan 19, 2021

I've been seeing this issue today. Running latest @google-cloud/vision-2.3.0 with node 15.3.0

Same thing as others, Error: 13 INTERNAL: Received RST_STREAM with code 2 and every so often 8 RESOURCE_EXHAUSTED: Bandwidth exhausted despite not having exceeded any quota on console.

Only calls to Google are:

const client = new vision.ImageAnnotatorClient({keyFilename : "..."});
client.batchAnnotateImages({requests : [{image : {content : pngData}, features : [{type : "LABEL_DETECTION"}, {type : "DOCUMENT_TEXT_DETECTION"}, {type : "SAFE_SEARCH_DETECTION"}]}]})

pngData is the raw PNG data from disk. Same identical code was working fine several days ago, just started getting this error for the first time today, no code changes.

@Sembiance
Copy link

Sembiance commented Jan 19, 2021

I worked around this bug by ditching the @google-cloud/vision library and calling the HTTP API endpoint directly.

See here: https://cloud.google.com/vision/docs/quickstart-cli

To get a Bearer auth_token in nodejs, npm install googleapis and then:

this.data.jwt = new google.auth.JWT(client_email, null, private_key, ["https://www.googleapis.com/auth/cloud-vision"], null);
this.data.jwt.authorize(this);

client_email and private_key can be found in your service_account key file.

The response includes a access_token which should be sent as an HTTP header Authorization: Bearer ${access_token} in your HTTP POST to https://vision.googleapis.com/v1/images:annotate

Note: You'll get a 404 error on the URL if you don't have the Authorization header. Once you add the header it works fine.

Using this direct approach everything works great, no errors or problems.

This issue is clearly a client side bug in a core component of Google's RPC node client libraries. This issue has been filed with multiple, other, google, api, libraries and goes back over 1 year. Since this doesn't appear to be a priority fix, I recommend everyone start calling the HTTP API endpoints directly.

@alexander-fenster
Copy link
Contributor

Hi folks,

If you keep seeing 13 INTERNAL errors mentioning RST_STREAM with code 2, please make sure you updated your dependency tree: rm -rf node_modules package-lock.json && npm install. Please make sure you have @grpc/grpc-js v1.2.9 or higher:

npm ls @grpc/grpc-js

If you keep seeing the issue on the newer gRPC version, please do report here.

Thank you!

@alexander-fenster alexander-fenster removed the 🚨 This issue needs some love. label Mar 11, 2021
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Mar 11, 2021
@david-taggun
Copy link

@alexander-fenster Still getting these errors mate.

 "@google-cloud/vision": "^2.3.1",
 "@grpc/grpc-js": "1.2.10"

Node: v12.16.1
MacOS: 10.15.7

This issue is still occurring when processing large volumes of images. We're getting the original error it's only started happening today prior to the upgrade we were running vision ^1.9.0

Error: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)
    at Object.callErrorFromStatus (node_modules/@grpc/grpc-js/build/src/call.js:31:26)
    at Object.onReceiveStatus (node_modules/@grpc/grpc-js/build/src/client.js:176:52)
    at Object.onReceiveStatus (node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
    at Object.onReceiveStatus (node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
    at node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

as well as

Error: 8 RESOURCE_EXHAUSTED: Bandwidth exhausted
    at Object.callErrorFromStatus (node_modules/@grpc/grpc-js/build/src/call.js:31:26)
    at Object.onReceiveStatus (node_modules/@grpc/grpc-js/build/src/client.js:176:52)
    at Object.onReceiveStatus (node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
    at Object.onReceiveStatus (node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
    at node_modules/@grpc/grpc-js/build/src/call-stream.js:145:78
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

@ooriana ooriana added the external This issue is blocked on a bug with the actual product. label Mar 25, 2021
@awxlfy
Copy link

awxlfy commented Mar 25, 2021

Bump because I'm also having this issue. Similar to @david-taggun I'm getting this error when sending larger quantities of images (not that crazy or anything)

Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: read ECONNRESET     
    at Object.callErrorFromStatus (node_modules\@grpc\grpc-js\build\src\call.js:31:26)
    at Object.onReceiveStatus (node_modules\@grpc\grpc-js\build\src\client.js:176:52)
    at Object.onReceiveStatus (node_modules\@grpc\grpc-js\build\src\client-interceptors.js:336:141)
    at Object.onReceiveStatus (node_modules\@grpc\grpc-js\build\src\client-interceptors.js:299:181)
    at node_modules\@grpc\grpc-js\build\src\call-stream.js:145:78
    at processTicksAndRejections (internal/process/task_queues.js:75:11)

Seems to be happening whenever I send around 30+ images within a couple minutes. Whenever I'm not getting the error it is taking painfully long to get a response (like 2-3 minutes for 8-10 images). Also, the images aren't crazy intricate or anything. They're fairly basic images such as a simple picture of a bus with nothing else.

"@google-cloud/vision": "^2.3.1"
"@grpc/grpc-js": "^1.2.12"
Node: `v14.15.5`
Windows: 10.0.19042 Build 19042

@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Mar 25, 2021
@AlejandroBaldwin
Copy link

I'm also receiving the same issue when requesting from the db, and while my db is pretty large, I'm setting the request with a limit() of 3.
Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: Protocol error .Object.callErrorFromStatus ( /workspace/node_modules/@grpc/grpc-js/build/src/call.js:31 )
grpc: "version": "1.2.11",

@AlejandroBaldwin
Copy link

I'm also receiving the same issue when requesting from the db, and while my db is pretty large, I'm setting the request with a limit() of 3.

`Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: Protocol error

.Object.callErrorFromStatus ( /workspace/node_modules/@grpc/grpc-js/build/src/call.js:31 )`

grpc: "version": "1.2.11",

Just to test my code, when I run the same request in the emulator with a significantly smaller db. I have no errors. So I think that the error comes from looking for all the files even though I'm limiting it to three

@meredithslota
Copy link
Contributor

A handful of related issues have been closed (in the gRPC layer) which we believe resolves the issue. Is anyone in this thread still seeing the issue with a recent version of the library? I'm going to close this out shortly if not.

If you are still seeing the issue, please include which version of the library / gRPC you're using. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: vision Issues related to the googleapis/nodejs-vision API. external This issue is blocked on a bug with the actual product. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests