我有一个 Azure Functions Powershell 核心,如下所示:
# 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)"
通过使用 Blob 触发器,我想使用 Powershell 从 Azure Blob 读取 VDH 操作系统镜像并将其转换为托管磁盘。图像大小为30GB。当函数被触发时,我得到下面的System.OutOfMemoryException:
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
我增加了应用程序计划以获得 14GB 内存,但我遇到了相同的内存异常。
当我直接从 Cloud Shell 执行此操作时,我成功,但我的主要目标是使用 自动化脚本 Blob 触发器。
你有什么建议吗?
最佳答案
检查Function App的平台配置:
功能 -> 配置 -> 常规设置 -> 平台
32 位的私有(private)字节数较少,并且即使实例具有更多容量,也可能会遇到内存不足异常。
如果您遇到这种情况,建议您升级到64 位。
关于Azure Functions 内存不足异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63775341/