【Azure 应用服务】Azure Function (PowerShell) 执行时报错 "out of memory"
问题描述
在Azure Function App服务中,创建一个PowerShell脚本的函数,遇见了OOM(Out Of Memory)的异常报错:
2022-01-10T07:44:37 Welcome, you are now connected to log-streaming service. The default timeout is 2 hours. Change the timeout with the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds).
2022-01-10T07:44:39.879 [Information] Executing 'Functions.BlobTrigger1' (Reason='New blob detected: Exception of type 'System.OutOfMemoryException' was thrown.', Id=xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx)
2022-01-10T07:44:39.883 [Information] Trigger Details: MessageId: xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx, DequeueCount: 5, InsertionTime: 2022-01-10T07:41:29.000+00:00, BlobCreated: 2022-01-10T07:41:28.000+00:00, BlobLastModified: 2022-01-10T07:41:28.000+00:00
2022-01-10T07:44:39.911 [Error] Executed 'Functions.BlobTrigger1' (Failed, Id=xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx, Duration=11084ms)Exception of type 'System.OutOfMemoryException' was thrown.
运行的脚本就是执行 AzCopy Copy 文件
param([byte[]] $InputBlob, $TriggerMetadata)
Write-Host "PowerShell Blob trigger function Processed blob! Name: $($TriggerMetadata.Name) Size: $($InputBlob.Length) bytes" $AzcoypFile = "azcopy.exe"
$AzCopyExists = Test-Path $AzcoypFile
Write-Host "AzCopy exists:" $AzCopyExists
# Download AzCopy.zip and unzip if it doesn't exist
If ($AzCopyExists -eq $False)
{
Write-Host "AzCopy not found. Downloading..." #Download AzCopy
Invoke-WebRequest -Uri "https://aka.ms/downloadazcopy-v10-windows" -OutFile AzCopy.zip -UseBasicParsing #unzip azcopy
write-host "unzip azcopy.zip"
Expand-Archive ./AzCopy.zip ./AzCopy -Force
# Copy AzCopy to current dir
Get-ChildItem ./AzCopy/*/azcopy.exe | Copy-Item -Destination "./AzCopy.exe"
} # Run AzCopy from source blob to destination blob (Single Direction)
Write-Host "copy new content"
./azcopy.exe sync "https://xxxxxxxxxxxxxxxxx..............
问题分析
因为默认创建Azure Funciton Windows环境时,平台默认使用的是32 Bit,所以存在内存上限问题。所以最快方法就是查看平台的位数,修改为64 Bit。让系统有更多的内存空间可用。

参考资料
I see the message "Worker Process requested recycle due to 'Percent Memory' limit." How do I address this issue?
The maximum available amount of memory for a 32-bit process (even on a 64-bit operating system) is 2 GB. By default, the worker process is set to 32-bit in App Service (for compatibility with legacy web applications).
Consider switching to 64-bit processes so you can take advantage of the additional memory available in your Web Worker role. This triggers a web app restart, so schedule accordingly.
Also note that a 64-bit environment requires a Basic or Standard service plan. Free and Shared plans always run in a 32-bit environment.
【Azure 应用服务】Azure Function (PowerShell) 执行时报错 "out of memory"的更多相关文章
- 创建function函数sys_guid时报错
创建function函数sys_guid时报错 执行下面的命令 show variables like 'log_bin_trust_function_creators';set global log ...
- PyQt程序执行时报错:AttributeError: 'winTest' object has no attribute 'setCentralWidget'的解决方法
用QtDesigner设计了一个UI界面,保存在文件Ui_wintest.ui中,界面中使用了MainWindow窗口,窗口名字也叫MainWindow,用PyUIC将其转换成了 Ui_wintest ...
- 【Azure 应用服务】使用PowerShell脚本上传文件至App Service目录
问题描述 使用PowerShell脚本上传文件至App Service目录的示例 脚本示例 对文件进行上传,使用的 WebClient.UploadFile 方法进行上传.当文件夹中包含子目录,执行以 ...
- 高版本 MySQL 导出的脚本到低版本 MySQL 中执行时报错
导入 MySQL 脚本时报错:[ERR] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci'低版本还不支持 utfmb4 这个字符集 解决方法:将 sql 脚 ...
- 『奇葩问题集锦』function * (next){ 执行报错 SyntaxError: Unexpected token *
这是因为 app.use(function * (){ 语句中有一个 * ,这种方式被称为generator functions ,一般写作function *(){...} 的形式,在此类func ...
- mac Robotframework执行时报错Robot Framework installation not found.
虽然已经装了,但一直报错 ,版本是3.1.1 最新版 ➜ ~ pip install robotframework DEPRECATION: Python 2.7 will reach the en ...
- Android项目执行时报错NoclassDefFoundError
导Android项目时碰到个头疼的NoclassDefFoundError. 项目导入之后是没有报错的.可是执行就报这个错误 java.lang.NoClassDefFoundError: andro ...
- 问题:程序编译通过,但是执行时报错:coredump
问题描述: 在一个客户现场搭建环境时,遇到了一个棘手的问题,C代码编译通过后,无法正常运行,启动会出现“coredump”错误. 运行环境为新搭建的AIX6.1,数据库为Oracle11.2.0.2. ...
- jmeter通过ant执行时报错 jmeter.log not found
原因:权限执行不够,改为root用户即可 :sudo su 日志报错如下: test: [jmeter] Executing test plan: /home/ec2-user/jmeterProg ...
- C语言执行时报错“表达式必须是可修改的左值,无法从“const char [3]”转换为“char [120]” ”,原因:字符串不能直接赋值
解决该问题的方法:使用strcpy函数进行字符串拷贝 原型声明:char *strcpy(char* dest, const char *src); 头文件:#include <string ...
随机推荐
- 小Min_25筛小记🐤
这里的小Min_25筛,可以筛出 $10^11$ 以内所有质数的完全积性函数之和 注意事项: 1. cmd 的题解里面下标写得不清楚,应该是 $S'(p_k-1,k-1)$ 而不是 $S'(p_{k- ...
- Redis极简教程
简介 Redis 是用C语言开发完全开源免费的,遵守BSD协议的,一个高性能的,key-value型的,NOSQL数据库. 特点 可以将内存中的数据持久化到硬盘中,重启的时候可以从硬盘中再次加载 拥有 ...
- elementui中el-checkbox 选中时的详细介绍
checkbox-group 把多个checkbox管理为一组(需要注意的坑) 很多时候我们需要会遇见这样的场景. 比如用户需要选择多个值. 这个时候我们需要把多个 checkbox 放置在check ...
- Vue中is属性的用法 可以动态切换组件
is 是组件的一个属性,用来展示组件的名称 is和component联用哈 vue提供了component来展示对应的组件名称 compont是一个占位符,is这个属性,用来展示对应的组件名称 三个子 ...
- 微信小程序-双线程渲染模型
微信小程序双线程渲染模型 小程序的运行环境分成渲染层和逻辑层: WXML 模板和 WXSS 样式工作在渲染层,通过 WebView 进行渲染 小程序会为每一个界面都创建一个 WebView 来渲染这个 ...
- 设计模式学习-使用go实现组合模式
组合模式 定义 适用范围 优点 缺点 代码实现 参考 组合模式 定义 组合模式(Composite),将对象组合成树形结构以表示'部分-整体'的层次关系.组合模式使得用户对单个对象和组合对象的使用具有 ...
- Linux 统计Web服务日志命令
本人在Linux运维中收集的一些通用的统计,Apache/Nginx服务器日志的命令组合. Apache日志统计 # 列出当天访问次数最多的IP命令 [root@lyshark.cnblogs.com ...
- Mocha MemoryBufferQueue 设计概述
目录 前言 MemoryBufferQueue 功能概述 Buffer 模块 API 设计 MemoryBufferQueue 的设计 Partition 的设计 对并发的支持 Partition 的 ...
- 源代码安装Nginx和PHP
源代码安装Nginx和PHP 一.安装前准备: 有些工具在安装Nginx必备.譬如gcc用来编译C程序,gcc-c++ 用来编译C++程序,wget用来从网络下载文件. [root@localhost ...
- NC18389 收益
题目链接 题目 题目描述 小N是一家金融公司的项目经理.他准备投资一个项目,这个项目要融资L元,融资成功后会得到M元的利润.现在有n个客户.对于第i个客户,他有mi元钱.小N承诺假如最后筹够钱,会给这 ...