Azure Functions Error - 'System.OutOfMemoryException' was thrown
When running blob triggered Azure Functions V4 in .NET 6 dotnet-isolated worker, I encountered the following error:
2021-10-15T09:22:46.102 [Information] Trigger Details: MessageId: 71d0888a-88d2-48dc-8e6f-18b32f29f34e, DequeueCount: 1, InsertedOn: 2021-10-15T09:22:45.000+00:00, BlobCreated: 2021-10-14T22:12:37.000+00:00, BlobLastModified: 2021-10-15T09:22:35.000+00:00
2021-10-15T09:22:46.609 [Error] Executed 'Functions.***' (Failed, Id=b49f7d79-416b-480b-a1e5-d6a9c00e1c51, Duration=911ms)Exception of type 'System.OutOfMemoryException' was thrown.
2021-10-15T09:22:47.018 [Error] An unhandled exception has occurred. Host is shutting down.Exception of type 'System.OutOfMemoryException' was thrown.
.NET 6 worker was set as 64bit and the concurrency for the function run is set as 1 (configured in host.json and the default is 8).
Configuration property maxDegreeOfParallelism represents the integer number of concurrent invocations allowed for each blob-triggered function. The minimum allowed value is 1.
For my case, I've notified one issue about my email sending function where message object was not disposed. Thus I've changed to always dispose it and this has been working ok after that change. I will update this thread if there are new findings.