OutOfMemoryException on V3 to V4 Migration (with .NET Core 3.1 to .NET 6.0)
See original GitHub issueI migrated an existing .NET Core 3.1 in-proc Azure Functions app to .NET 6.0 using the guidance at https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=in-process%2Cv4&pivots=programming-language-csharp#migrating-from-3x-to-4x. Then I published (with setting delete all extra files) to the slot where the .NET Core 3.1 function lived and worked nicely for months.
The code in question opens read to Blob storage (custom code, no trigger). Simplified:
var client = new BlobServiceClient(new Uri($"https://{_accountName}.blob.core.windows.net"), _accountCredentials);
var blobClient = client.GetBlobContainerClient(containerName).GetBlobClient(blobName);
var stream = await blobClient.OpenReadAsync(new BlobOpenReadOptions(false));
This then OOMs.
Investigative information
- Windows consumption tier
- Timestamp: 2021-11-23 10:07:17.691
- Function App version: 4.0.1.16815
- Function App name: eeazfuncppe
- Function name(s) (as appropriate): ReadRevitVersion
| where operation_Id == ‘2c0db5f3218278cae72bf3ae9bdeced7’ | where customDimensions[‘InvocationId’] == ‘6299cbff-aaa3-4d2b-8bfe-9184dcede4ca’
Exception:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.GC.AllocateNewArray(IntPtr typeHandle, Int32 length, GC_ALLOC_FLAGS flags)
at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1.Rent(Int32 minimumLength)
at Azure.Storage.Blobs.Specialized.BlobBaseClient.OpenReadInternal(Int64 position, Nullable`1 bufferSize, BlobRequestConditions conditions, Boolean allowModifications, Boolean async, CancellationToken cancellationToken)
at Azure.Storage.Blobs.Specialized.BlobBaseClient.OpenReadAsync(BlobOpenReadOptions options, CancellationToken cancellationToken)
at MyFunc.ReadRevitVersionFunc.Run(HttpRequest req, ILogger log) in D:\VIMaecWorkspace\Repos\estimatingedge\src\MyFunc\ReadRevitVersionFunc.cs:line 37
Side-note: I am having problems with OOM on Windows Docker Container for .NET 6.0 too (totally different though), so maybe that is related here.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Thanks @christophwille for sharing the details!. There is a known issue in the platform for x64 bit Function Apps running on Windows in dynamic sku. Fix will be rolled out in the next couple of months. Until then please set App Setting:
COMPLUS_GCHeapHardLimit
to the value0x60000000
cc @fabiocav @kranthikumarm @safihamid
We are experiencing the same issue after migrating an app from .NET Core 3.1 + Functions v3 to .NET 6 + Functions v4.
64bit app config.
Is that related to https://github.com/Azure/azure-functions-host/issues/5430 ?