Azure Functions Out of Memory Exceptions

Viewed 3780

I have an Azure Functions Powershell core as below:

# Input bindings are passed in via param block.
param([byte[]] $InputBlob, $TriggerMetadata)

# Write out the blob name and size to the information log.
Write-Host "PowerShell Blob trigger function Processed blob! Name: $($TriggerMetadata.Name) Size: $($InputBlob.Length) bytes  Uri: $($TriggerMetadata.Uri)"

By using a Blob Trigger i want to read VDH OS images with Powershell from Azure Blob and convert them to managed disk. The size of the image is 30GB. When the function is triggered, i get the System.OutOfMemoryException below:

2020-09-07T09:52:44.704 [Error] Executed 'Functions.BlobTrigger1' (Failed, Id=93b00718-9941-4379-abd0-348137cdcff2, Duration=56449ms)Exception of type 'System.OutOfMemoryException' was thrown.
2020-09-07T09:52:45.061 [Information] Stopping JobHost

I have increased the App Plan in order to have 14GB of memory but i got the same memory exception.

When i do this operation directly from Cloud Shell, i get success but my main aim is to automize the script with Blob Trigger.

Do you have any advice?

1 Answers

Check the platform configuration of the Function App :

Function -> Configuration -> General Settings -> Platform

enter image description here

The 32 Bit will have less private bytes and it can hit the out of memory exceptions even though the instance has much more capacity.

If this is your case, recommend you to upgrade to the 64 bit.

Related