Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Maximum call stack size exceeded #2470

Closed
4 of 9 tasks
doniyor2109 opened this issue Mar 4, 2020 · 10 comments
Closed
4 of 9 tasks

RangeError: Maximum call stack size exceeded #2470

doniyor2109 opened this issue Mar 4, 2020 · 10 comments

Comments

@doniyor2109
Copy link

doniyor2109 commented Mar 4, 2020

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.12.4

Description

Sentry sends RangeError: Maximum call stack size exceeded error from @sentry/utils/instruments.ts.

Here is Sentry event: https://sentry.io/share/issue/82cc1c5e3bc4418ebccecee6c324d9d1/

Browser: Chrome Mobile WebView 64.0.3282
Platform: Android 7.1.1

@kamilogorek
Copy link
Contributor

It looks like your code might have an infinite event loop. And because we collect breadcrumbs through wrapping native API, it looks like it comes from Sentry.
You should be able to see where it originates from by blackboxing either our bundle or CDN file (or instrument.ts itself if you have access to sourcemaps) in devtools. Devtools => Settings => Blackboxing.
Line 85 in helpers.ts points to user-land function invocation, which would confirm my suspicions.

@doniyor2109
Copy link
Author

@kamilogorek Thanks for the detailed explanation.

@kamilogorek
Copy link
Contributor

Anytime. Please feel free to ping me if it's still relevant issue, I'll reopen it.

@neelamc-active
Copy link

Please explain more considered we are very new in angular.

@kamilogorek
Copy link
Contributor

I'm not sure what I could explain more other than what my comment above did 😅

@ybrodsky
Copy link

ybrodsky commented Oct 7, 2020

I am getting a similar error

RangeError null.<anonymous>(@sentry.hub.src:scope.ts)
error
Maximum call stack size exceeded

I am using nextjs so I have sentry logging errors from the backend and the frontend. This error originates in the backend.
I am using it this way:

server.use(Sentry.Handlers.requestHandler());

// my routes ...:

server.use(Sentry.Handlers.errorHandler());

Any idea?

@linehammer
Copy link

This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited.

How to fix it?

Wrap your recursive function call into a -

  • setTimeout
  • setImmediate or
  • process.nextTick

Also, you can localize the issue by setting a breakpoint on RangeError type of exception , and then adjust the code appropriately.

@wen-kai
Copy link

wen-kai commented Feb 9, 2022

In case anyone runs into this in the future -- our users were having intermittent crashes with rangeError: Maximum call stack size exceeded in production (mainly IOS) after we integrated Sentry's react navigation v4 instrumentation. After removing the automatic instrumentation the crashes were resolved. It's possible for our AppStack to re-render as it's wrapped in a few HoC, so it may inherently be a bug with how we've set up our react-navigation rather than the actual Sentry react navigation instrumentation module. Hope this helps anyone encountering something similar -- it was a tough one to track down.

@gre
Copy link

gre commented May 20, 2022

Thanks @wen-kai for your comment, we are having the same problem. Unfortunately Sentry logic isn't very protective and not preventing infinite loop in objects. an object that have nested inside some reference of a parent will infinitely make dropUndefinedKeys loop https://github.com/getsentry/sentry-javascript/blob/master/packages/utils/src/object.ts#L197

There is nothing "wrong" with the user land code actually it's crashing inside Sentry logic (at least for us) as soon as you pass a recursive object in navigation.

cc @kamilogorek let us know if we need to create a new issue or reopen this one. thanks.

(a way to fix it is to allow a max depth in the code so you can detect something is wrong. another way is to track the parents that you enters and see if there is a loop)

gre added a commit to LedgerHQ/ledger-live that referenced this issue May 20, 2022
due to some recursive objects in our stack and passed in navigation, it makes Sentry crash when tracking the performance. problem was reported to getsentry/sentry-javascript#2470 but in the meantime, we are disabling the feature for now.
@kamilogorek
Copy link
Contributor

@gre yes, please create a new one so that team can triage it, thanks!

valpinkman pushed a commit to LedgerHQ/ledger-live that referenced this issue May 24, 2022
* Disable React Navigation sentry integration

due to some recursive objects in our stack and passed in navigation, it makes Sentry crash when tracking the performance. problem was reported to getsentry/sentry-javascript#2470 but in the meantime, we are disabling the feature for now.

* add changeset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants