【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 ...
随机推荐
- 重新学习一下new Date()
new Date()你知道多少 很多小伙伴可能都知道, Date是js中的一个内置对象,用于处理日期和时间. 当你调用 new Date() 时,它会创建一个新的日期(Date) 对象. 表示当前本地 ...
- vue获取子组件的实例$el、$attrs和inheritAttrs的使用
我的需求 有些时候,我们需要获取组件的DOM元素 有些小伙伴会说,这还不简单 直接使用this.$ref.xx不就可以了吗 我们来看一下,是不是我们想的那样简单 组件内容 <template&g ...
- Stable Diffusion WebUI Model 加载个人笔记
参考1:https://www.bilibili.com/read/cv20039815 参考2:https://blog.cmyr.ltd/archives/e740aac.html 服务器:阿里云 ...
- 【K哥爬虫普法】淘宝一亿快递信息泄漏,有人正在盯着你的网购!
我国目前并未出台专门针对网络爬虫技术的法律规范,但在司法实践中,相关判决已屡见不鲜,K 哥特设了"K哥爬虫普法"专栏,本栏目通过对真实案例的分析,旨在提高广大爬虫工程师的法律意识, ...
- 【JS 逆向百例】W店UA,OB反混淆,抓包替换CORS跨域错误分析
关注微信公众号:K哥爬虫,持续分享爬虫进阶.JS/安卓逆向等技术干货! 声明 本文章中所有内容仅供学习交流,抓包内容.敏感网址.数据接口均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后 ...
- CLion搭建Qt开发环境,并解决目录重构问题(最新版)
序言 Qt版本不断更新,QtCreator也不断更新.在Qt4和Qt5时代,我一直认为开发Qt最好的IDE就是自带的QtCreator,可是时至今日,到了Qt6时代,QtCreator已经都12.0. ...
- minIO系列文章01---MinIO 简介
MinIO.jpeg MinIO 官网 MinIO 官方GitHub MinIO 官方文档 1.什么是对象存储? 关于对象存储,我们可以看下 阿里云OSS 的解释. 对象存储服务OSS(Object ...
- 微信小程序-页面跳转navigator组件
官方文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/route.html 在官方文档当中有提到一 ...
- 驱动开发:运用VAD隐藏R3内存思路
在进程的_EPROCESS中有一个_RTL_AVL_TREE类型的VadRoot成员,它是一个存放进程内存块的二叉树结构,如果我们找到了这个二叉树中我们想要隐藏的内存,直接将这个内存在二叉树中抹去,其 ...
- .NET桌面程序如何设置任务栏图标右键菜单中的名称
右键任务栏中应用程序图标时会显示程序名称,例如: 这里显示的并不是程序文件名DingTalk,而是文件属性中详细信息选显卡下的"文件说明". 在.NET桌面程序中,是通过修改程序集 ...