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

[BUG] - CRITICAL - Application runs out of memory #2235

Closed
mmonteiroc opened this issue Jan 10, 2024 · 7 comments
Closed

[BUG] - CRITICAL - Application runs out of memory #2235

mmonteiroc opened this issue Jan 10, 2024 · 7 comments
Assignees
Milestone

Comments

@mmonteiroc
Copy link

mmonteiroc commented Jan 10, 2024

Description/Screenshot

We have discovered recently a memory crash in our production application. In this case, we found out that happens whenever the track calls that application insights does automatically fail with a 400 ( not much we can do / fix in our side for this, as is your SDK who is doing the wrong request ).

When this happen, your SDK does a massive amount of retries which causes our app to freeze and eventually throw a popo up saying that the page is blocked.

We have checked the configuration parameters to see if we can disable this retry, and we found out that we can but only when it fails with some specific response errors.

I put CRITICAL in the header, because this happened to us in production, and I guess it can happen to any other user of this library as well.

image
image
image
image
image

Steps to Reproduce

  • OS/Browser: Mainly chrome / edge, but also firefox ( All OS )
  • SDK Version [e.g. 22]: "@microsoft/applicationinsights-web": "^3.0.7",
  • How you initialized the SDK:
      AppMonitoringService.appInsights = new ApplicationInsights({
        config: {
          instrumentationKey: RaConfigService.settings.instrumentationKeyApplicationInsight,
          autoTrackPageVisitTime: true,
          enableAjaxPerfTracking: true,
          enableAjaxErrorStatusText: true,
          enableCorsCorrelation: true,
          isRetryDisabled: true,
          maxAjaxCallsPerView: 200,
          eventsLimitInMem: 1000,
          maxBatchInterval: 60000 // Each minute
        }
      });

Expected behavior

Additional context
Add any other context about the problem here.

@MSNev
Copy link
Collaborator

MSNev commented Jan 10, 2024

Ping requests are only sent (by default) as part of the page unload state (user is navigating away in some form -- which includes switching to another tab), as part of some changes (which we have been using internally for years) we are attempting to "flush" as many events as possible to ensure that all of your requested events can be sent.

When we do this we are limited to using either sendBeacon() or fetch (with the keep-alive flag) both of which have a 64Kb transmission limit so if you have a lot of batched events this can cause lots of multiple requests (which appears to be what you are seeing).

There are a couple of additional configurations that you can add to "stop" this behavior and thus avoid the ping requests (at the potential expense of loosing events -- which you may have had previously)

disableSendBeaconSplit and onunloadDisableFetch, setting both to true will disable new behavior and default back to the previous sending sequence.

@Karlie-777 can you have another look and see if we have any additional edge cases that are not being addressed

@mmonteiroc Can you also please check your lock file to ensure that you are using at least v 3.0.7 as there was a bug in 3.0.5 which caused the exact behavior you are having (see https://github.com/microsoft/ApplicationInsights-JS/blob/release-3.0/RELEASES.md). You can also see the SDK version number in the outbound JSON content of the track call

@mmonteiroc
Copy link
Author

@MSNev I believe we are indeed using the v 3.0.7
image

@mmonteiroc
Copy link
Author

@MSNev thanks for the "work-around" while you investigate this.

If it helps, we started noticing this issue since almost 1 month now :)

@MSNev MSNev added this to the 3.0.8 milestone Jan 10, 2024
@mmonteiroc
Copy link
Author

@MSNev I just re-checked and actually in prod we have the v3.0.5

I will do a prod update ASAP to put the v3.0.7 and verify if this error still happens. Sorry for that, I will keep you updated.

@MSNev
Copy link
Collaborator

MSNev commented Jan 11, 2024

NP - That makes sense as @Karlie-777 was having difficulties trying to reproduce your issue with v 3.0.7

@scominoekd
Copy link

Hi, I'm using azure maps SDK Javascript and it's happening the same as you describe. What was the solution?

image

@MSNev
Copy link
Collaborator

MSNev commented Jan 12, 2024

Is the Azure Maps SDK pinned to a specific version of Application Insights? If not clear your lock file and force it to update to the latest version (3.0.7). If not please raise an issue on them to move to the latest version.

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

No branches or pull requests

4 participants