【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 ...
随机推荐
- 从Spring源码看Spring如何解决循环引用的问题
Spring如何解决循环引用的问题 关于循环引用,首先说一个结论: Spring能够解决的情况为:两个对象都是单实例.且通过set方法进行注入. 两个对象都是单实例,通过构造方法进行注入,Spring ...
- python从新手到安装指南
说到python我是跟着官方文档自学入门,本文适用于windows 操作系统,基于Inter和amd的CPU(涵盖市面80%的电脑) 下载和安装python 对于window操作系统的初学者,进入 p ...
- Flowable 源码目录结构
title: Flowable 源码目录结构 date: 2023-8-17 23:47:20 tags: - Flowable 下载源码 下载地址:flowable/flowable-engine ...
- 【云原生】为什么要虚拟化,为什么要容器,为什么要Docker,为什么要K8S?
前言 如标题中的问题所提到的虚拟化,容器,Docker和K8s那样,我们不妨这样问:这些技术到底适用于哪些场景,有没有别的技术可以替代?这些技术的优劣在哪里? 下面我将针对性地从以上几个问题的出发点, ...
- LyScript 寻找ROP漏洞指令片段
ROP绕过片段简单科普一下,你可以理解成一个可以关闭系统自身内存保护的一段机器指令,这段代码需要我们自己构造,这就涉及到在对端内存搜寻这样的指令,LyScript插件增强了指令片段的查找功能,但需要我 ...
- 【可观测性系列】 Opentelemetry 介绍
作者简介:大家好,我是蓝胖子 ️博客首页:博客园主页蓝胖子的编程梦 每日一句:人生的烦恼,多在于明白的太多,而做的太少 大家好,我是蓝胖子,随着微服务的流行,服务的可观测性概念被越来越多人提及到,究竟 ...
- 【进阶篇】Java 实际开发中积累的几个小技巧(一)
目录 前言 一.枚举类的注解 二.RESTful 接口 三.类属性转换 四.Stream 流 五.判空和断言 5.1判空部分 5.2断言部分 文章小结 前言 笔者目前从事一线 Java 开发今年是第 ...
- 图(树)的深度优先遍历dfs
图的深度优先遍历 深度优先,即对于一个图或者树来说,在遍历时优先考虑图或者树的单一路径的深度.示意图如下 即深度优先搜索的核心就是对一个路径一直向下搜索,当搜索到头时就回溯到前一状态再寻找别的路 深搜 ...
- Exadata存储节点的CPU限制成功了没?
上篇随笔谈到刷1/8 rack时,日志显示存储节点已经成功限制CPU的,可如果使用mpstat命令看貌似还是64 CPU,难道实际没有成功吗? [root@dbm08celadm03 ~]# mpst ...
- require 与 import
common.js 模块化规范 app.js 文件: // require 在代码执行阶段才会调用引入文件,编译(预解析)时不会执行,所以下面会报错 // console.log(dep); Re ...