Infinite loop when API quota is exceeded and reportUncaughtExceptions is enabled
See original GitHub issueWhen there are large volumes of errors that exceed Stackdriver reporting quota, HTTP 429 responses are received as a response, letting the caller know too many requests are being sent.
These are thrown as errors by StackdriverErrorReporter
here:
https://github.com/GoogleCloudPlatform/stackdriver-errors-js/blob/master/stackdriver-errors.js#L184
If reportUncaughtExceptions
is enabled, then this results in the reporter trying to report those errors, receiving more HTTP 429 responses, and going into an infinite loop.
The end result is a tab “crash” (infinite loop causing CPU to be used at 100% and browser tab to become unresponsive).
I can do the work to create a fix and send over a PR, but I’m a little unsure of the best way to handle this scenario.
-
We could just not log these, but it might be useful to surface this somehow so you’d be aware you’re exceeding your quota?
-
One thought is to sample those kinds of errors at a reduced rate, i.e.
if (xhr.status === 429 && Math.random() > 0.99) {
// throw the error
}
I mean, you wouldn’t get a lot of them, but it might be enough that you’d investigate the issue?
Appreciate any thoughts / feedback on how to fix this, thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
I need to publish a new version in
npm
, which contributors cannot do. I’ll do it this week.Great catch.
I would expect customers to learn about quota limits from different mechanisms instead of relying on this client side library, so I suggest to implement 1 (not log these)