ApplicationInsights-node.js: ApplicationInsights crashes Node server with "RangeError: Maximum call stack size exceeded"

Hello,

We’re seeing an issue where our Node server is crashing when we have AppInsights configured. When the server starts it can handle requests fine, but if we just let it run for about 30 minutes, it’ll crash and give us this error message:

D:\repos\DemoPartner\build\server.js:148960
                return value.apply(this, [error, structuredStackTrace]);
                             ^

RangeError: Maximum call stack size exceeded

The stack trace is pointing to what looks like zone.js code, which is a dependency from AppInsights. We confirmed that completely removing AppInsights fixes the problem.

I thought it might be related to #294, but we’re still seeing the issue after setting setAutoDependencyCorrelation(false) when configuring AppInsights.

Has anyone else seen this error, or have any suggestions?

Thanks, Matt Dyke

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (9 by maintainers)

Most upvoted comments

@christianrondeau Forgot to update this thread to mention that the stable version was published some time ago. Latest is now 1.2.0

To answer your question @markwolff the error itself was mine and expected (it was an early GraphQL precompilation error in my code, which usually triggered the infinite loop), so unrelated to this issue. Thanks a lot for following up, I’ll use the beta until the official release it published!

Hi everyone - it seems like this release has solved the issue for us as well. I was able to leave our server running over the entire weekend and it is still alive and serving requests so far without any sign of the previous errors.

If I do start seeing the issue again I’ll update here, but for now it looks like this is fixed. Thanks everyone for your help!

Ok, I think I can confirm the issue is solved. I had a startup exception (which always ended up with an infinite loop “the first time”, and I have instead:

...\node_modules\applicationinsights\out\AutoCollection\Exceptions.js:34
                        throw THIS_IS_APPLICATION_INSIGHTS_RETHROWING_YOUR_EXCEPTION; // Error originated somewhere else in your app

Got me confused for a second, but I understand why you did this weird throw line 😃 So as far as I can tell this is “normal behavior”, and the infinite loop is not happening anymore even in cases that were reliably happening on my end before.

@madyke It seems #474 is passing tests and ready to go after addressing a few more remaining items. There is nothing else planned to be tied in with the next release. I’m probably going to release it as a beta first, so it’d be awesome if you could test it out and let me know if it fixes all of your problems. I’ll let you know when it’s published!