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

OutOfMemoryException due to referenced strings. #2910

Open
yaroslavlsd opened this issue Oct 28, 2024 · 0 comments
Open

OutOfMemoryException due to referenced strings. #2910

yaroslavlsd opened this issue Oct 28, 2024 · 0 comments
Labels

Comments

@yaroslavlsd
Copy link

yaroslavlsd commented Oct 28, 2024

    <PackageVersion Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
    <PackageVersion Include="Microsoft.Extensions.Logging.ApplicationInsights" Version="2.22.0" />
    <PackageVersion Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
  • Runtime version (e.g. net461, net48, netcoreapp2.1, netcoreapp3.1, etc. You can find this information from the *.csproj file):
    <TargetFramework>net8.0</TargetFramework>
  • Hosting environment (e.g. Azure Web App, App Service on Linux, Windows, Ubuntu, etc.):
Azure Function Isolated Premium x86 

Describe the bug

Azure Function application with an x86 environment (and ~2GB of process memory) crashed due to an OutOfMemoryException.

Analyzing the full memory dump shows that memory consists of too many strings (1.5GB) which are referenced by App Insights. We have some code, a simplified version is below, and we failed to properly set up the client configuration, resulting in a while loop without any delay. As a result, it looks like App Insights can't send logs, but new logs are incoming.
A possible fix is to create a "MaxPendingLogsSize" option in the App Insights library and try to send only some of them.

I still have dump.

To Reproduce

while(true)
{
    logger.LogLnformation("Client started, now = {time}", DateTime.UtcNow);
    //await client.RunAsync();
}

Image

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

No branches or pull requests

1 participant