firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

Exception occurred in retry method that was not classified as transient

Open lamstutz opened this issue 7 years ago • 171 comments

Related issues

https://github.com/firebase/firebase-functions/issues/522

[REQUIRED] Version info

  "dependencies": {
    "@google-cloud/firestore": "^2.2.1",
    "firebase-admin": "^8.2.0",
    "firebase-functions": "^3.0.1",
  },
  "engines": {
    "node": "8"
  }

node: 8

firebase-functions: 3.0.1

firebase-tools: 7.0.1

firebase-admin: 8.2.0

Steps to reproduce

import * as admin from 'firebase-admin';

admin.initializeApp();
const db = admin.firestore();
db.settings({ timestampsInSnapshots: true });


const users = db.collection('users');

users.doc('myUserId').update({ fieldToUpdate: 'newValue' })

Update method throw this error :

{ Error at Http2CallStream.call.on (/srv/node_modules/@grpc/grpc-js/build/src/client.js:101:45) at emitOne (events.js:121:20) at Http2CallStream.emit (events.js:211:7) at process.nextTick (/srv/node_modules/@grpc/grpc-js/build/src/call-stream.js:71:22) at _combinedTickCallback (internal/process/next_tick.js:132:7) at process._tickDomainCallback (internal/process/next_tick.js:219:9) code: 13, details: '', metadata: Metadata { options: undefined, internalRepr: Map {} }, note: 'Exception occurred in retry method that was not classified as transient' }

Were you able to successfully deploy your functions?

the deployment displays no errors

lamstutz avatar Jul 23 '19 13:07 lamstutz

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Jul 23 '19 13:07 google-oss-bot

Hi @lamstutz does this occur on every function invocation? Would you mind pasting more logs? Also, does this happen when updating other collections?

thechenky avatar Jul 24 '19 22:07 thechenky

Having same error

does this occur on every function invocation?

No. [following statement is might be wrong] this error happens only after idle function is invoked after longer period of time.

audkar avatar Jul 25 '19 07:07 audkar

From the stack trace and the fact that it happens on idle function it looks like a grpc related error that is happening on a cold start. Does this happen on other collection updates? Are you properly handling promises in this function? Because the stack trace mentions retries, it may be happening because the value you're trying to write into Firestore is somehow problematic - are you able to replicate this with another collection with a very simple interface - something like updating one field that is string?

thechenky avatar Jul 25 '19 19:07 thechenky

The error occurs regularly but not systematically. Only with "update" function (whether with a simple object or an increment). Only with "triggers", not with a http function. Promises are well used and catched.

ex:

const categoryIds = ['a','b'];
  return users.doc(userId).update({ categoryIds });

Or

return statistics.doc('users').update({ users: gcFieldValue.increment(-1) });

lamstutz avatar Jul 26 '19 08:07 lamstutz

Hmm, it seems that something is going wrong with that particular Firestore update call - @schmidt-sebastian @hiranya911 I wonder if you have ideas on what could be going wrong here?

thechenky avatar Jul 26 '19 16:07 thechenky

I am having the exact same problem

McGroover-Bottleneck avatar Jul 29 '19 13:07 McGroover-Bottleneck

I have to add that in my experience the problem is also present with 'http' calls and not only with 'triggers'. It seems it is (extra) present when an instance/function went to sleep and has indeed a 'cold start'.

spoxies avatar Jul 29 '19 14:07 spoxies

I'm having the same problem. I'm receiving this error.

Error at Http2CallStream.call.on (/srv/node_modules/@grpc/grpc-js/build/src/client.js:96:45) at emitOne (events.js:121:20) at Http2CallStream.emit (events.js:211:7) at process.nextTick (/srv/node_modules/@grpc/grpc-js/build/src/call-stream.js:71:22) at _combinedTickCallback (internal/process/next_tick.js:132:7) at process._tickDomainCallback (internal/process/next_tick.js:219:9

Mine seems to happen randomly in onCreate and onWrite functions. These functions with this error are triggered daily and the error has only occurred once, I've had them fire multiple times after error occurred and error has yet to return. These errors start appearing once I updated firebase functions from version 2.3.0 to 3.0.1 and firebase admin from 7.0.0 to 8.0.0

stshelton avatar Jul 29 '19 18:07 stshelton

Just thought I'd give some input here. My first instance of this error was on the 15th of July and I now get it regularly (but not consistently) across all our functions.

We have a logging system implemented on our functions that essentially tells us when a function is cold started or not, (we ping them to keep warm every minute). Prior to the 15th of July (from 2017 to now! so I have a lot of logs on this) (ie when these errors started happening to me) cloud functions would delete themselves at approx. 3-5 minute intervals from first creation, making the next invocation a cold start. Since the 15th of July this has increased substantially to greater than 5 hours(!!!) and we have seen today a function stay warm for 28 hours (causing a lot of issues to our caching). My guess would be that a previously short running connection is now having to cope with these much much much longer alive periods.

Now unfortunately we do not ping over the weekends, for cost reduction reasons, but on the 12th (and for the last 12+ months) it was cold starting every 3-5 minutes, and on the 15th it now doesn't cold start for 5+ hours. If this is a new 'feature' of cloud functions it is amazing btw! Almost makes them never have to hit cold starts if the keep warm invocations are done right.

jaycosaur avatar Jul 30 '19 02:07 jaycosaur

I am getting it with Pub/Sub functions. I also think it is related to cold starts

McGroover-Bottleneck avatar Jul 30 '19 11:07 McGroover-Bottleneck

Also started getting these recently :(

damienix avatar Jul 30 '19 11:07 damienix

Sorry for all the trouble this is causing! While we are currently looking into this, we don't have a strong lead as to what is going on. Please do bear with us.

schmidt-sebastian avatar Jul 30 '19 21:07 schmidt-sebastian

@damienix, @bottleneck-admin, @jaycosaur, @spoxies, @lamstutz:

Would you mind sending your project IDs and an approximate time window for these errors (including your timezone) to [email protected]? Thanks

schmidt-sebastian avatar Jul 30 '19 21:07 schmidt-sebastian

This also affects Cloud Run.

For googlers on this thread, 138705198 is the internal issue

steren avatar Jul 31 '19 15:07 steren

How do I private message you @schmidt-sebastian

McGroover-Bottleneck avatar Jul 31 '19 15:07 McGroover-Bottleneck

Thanks for sending us your project info. Our backend team will look into the errors. While they do, can you quickly confirm where your GCF instances are all running in Europe and where your Firestore project is located.

Thanks!

@bottleneck-admin If you need to send project-specific or confidential data to us for issue triage, the recommended way is to open a Support ticket via https://support.google.com/

schmidt-sebastian avatar Jul 31 '19 16:07 schmidt-sebastian

Mine are in europe-west2 and project is -> Google Cloud Platform (GCP) resource location europe-west2

McGroover-Bottleneck avatar Jul 31 '19 16:07 McGroover-Bottleneck

@steren @schmidt-sebastian

I came across this issue doing a google search.

I am seeing the same behavior surface from GRPC calls made by @grpc/grpc-js which is a dependency of @google-cloud/storage in my case.

We see intermittent failures in k8s pods when a large number of files are being streamed to storage objects via @google-cloud/storage.

If those logs might be useful let me know and I can provide a project id.

{ Error: The caller does not have permission at Http2CallStream.call.on (/home/app/node_modules/@grpc/grpc-js/build/src/client.js:101:45) at Http2CallStream.emit (events.js:194:15) at process.nextTick (/home/app/node_modules/@grpc/grpc-js/build/src/call-stream.js:71:22) at process._tickCallback (internal/process/next_tick.js:61:11) code 7 details: 'The caller does not have permission', metadata: Metadata { options: undefined, internalRepr: Map {} }, note: 'Exception occurred in retry method that was not classified as transient' }

Note we receive a code 7 instead of 13 like @lamstutz

ltomes avatar Jul 31 '19 21:07 ltomes

Our project is us-central1 for functions and project.

jaycosaur avatar Jul 31 '19 23:07 jaycosaur