Fix memory leak caused by initializing applicationinsights-web during SSR#2
Open
jrskerritt wants to merge 1 commit intoCMeeg:mainfrom
Open
Fix memory leak caused by initializing applicationinsights-web during SSR#2jrskerritt wants to merge 1 commit intoCMeeg:mainfrom
jrskerritt wants to merge 1 commit intoCMeeg:mainfrom
Conversation
|
@jrskerritt I would like to say thank you so much for this, I've implemented your changes and I noticed huge improvements in our container I highly recommend applying this patch ASAP. cc @CMeeg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Hi there!
First off, thank you for this template. It helped me out a lot when I was first setting up a Remix application that runs in Azure.
The app had trouble from the beginning with some intermittent poor performance, and as we started getting low amounts traffic, we noticed that it was becoming a regular problem, requiring us to restart our App Service frequently (eventually on a nightly basis).
Finally, I was able to identify the root cause of these issues - there is a memory leak that is caused by the
applicationinsights-webclient being initialized during SSR:The problem lies in Context.tsx, where
loadAppInsightsis called on the server when it doesn't need to be.I made a similar change to this PR in my own application that fixes the leak. It simply moves the initialization to a
useEffecthook, ensuring it is only called on the client.