React Native RUM errors after 30 minuted of inactivity

Alex Lapa

Posted on
Apr 22 2021

Issue

New Relic React Native Agent throws error Maximum call stack size exceeded after 30 minutes of app inactivity

Steps to reproduce:

  1. Instrument app with Raygun Native Agent github.com/MindscapeHQ/raygun4reactnative and enable RUM
  2. Run the app
  3. Put the app in background state
  4. Wait for at least 30 minutes
  5. Foreground the app

Expected: No errors

Actual: Error Maximum call stack size exceeded is reported to raygun

Investigation

Hypothesis

Based on the examination of the source code it was determined that RUM will try to rotate user session each time app goes into foreground:

Which in turn will call transmitRealUserMonitoringEvent which will try to rotate session again if last event was recorded over 30 minutes ago which will go into transmitRealUserMonitoringEvent again and eventually result in infinite recursive call

Following the code:

On foreground - callrotateRUMSession: https://github.com/MindscapeHQ/raygun4reactnative/blob/cf1782b89580a251f9a540bcb3ceb77ccc095e9a/sdk/src/RealUserMonitor.ts#L74

Call transmitRealUserMonitoringEvent https://github.com/MindscapeHQ/raygun4reactnative/blob/cf1782b89580a251f9a540bcb3ceb77ccc095e9a/sdk/src/RealUserMonitor.ts#L105

Call rotateRUMSession again https://github.com/MindscapeHQ/raygun4reactnative/blob/cf1782b89580a251f9a540bcb3ceb77ccc095e9a/sdk/src/RealUserMonitor.ts#L274


Deleted User

Raygun

Posted on
Apr 22 2021

Hi Alex,

Thank you for reporting this issue. The React Native SDK does appear to have a recursive call, continuously calling the rotateRUMSession method. We will investigate further and look to put out a fix as soon as we can. We will update this thread when we have more details to share.

Thank you again,
Mitchell


Deleted User

Raygun

Posted on
Apr 23 2021

Hi Alex,

We have released a fix for the runaway recursive method within RUM. Please try updating to v1.1.1 of the Raygun4ReactNative SDK and let us know if you experience any more issues.

https://www.npmjs.com/package/raygun4reactnative/v/1.1.1

Thank you again for reporting this issue.

Regards,
Mitchell.


Alex Lapa

Posted on
Apr 26 2021

Thank you Mitchell!


Deleted User

Raygun

Posted on
May 02 2021

No problem at all. Please let us know if you encounter any more issues.

Regards,
Mitchell.


Reply