【Azure Function】Azure Function中的Timer Trigger无法自动触发问题

简介: 【Azure Function】Azure Function中的Timer Trigger无法自动触发问题

问题描述

在Azure Function中,部署了定时触发器函数(Timer Trigger),却无法按时触发。

 

问题解答

登录Function的Kudu站点,查看 logfiles中 application/function/host目录下的日志文件,发现错误消息:

Singleton lock renewal failed for blob 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/host' with error code 409: LeaseIdMismatchWithLeaseOperation. The last successful renewal completed at 2024-05-05T00:07:29.916Z (18845 milliseconds ago) with a duration of 48 milliseconds. The lease period was 15000 milliseconds.

这表示当前Function App不能从所绑定的Storage Account获取Lease,无法为Timer Trigger提供触发所需的Host ID / Lease ID信息。多个function app不建议用同一个storage account,因为function app都会在storage account中保存一个 host id,这个host id根据function app的名称来算的,如果function app 的名称长度大于32,就截取前32位。如果是一样的值,就会用同一个host id。导致出现争抢 Singleton Lock情况。

因为当前多个Function的确存在共用一个Stroage Account,并且名称长度超过32为,并且前32位的字符和其它Function App一样,所以引起了以上问题。在不能修改Function App的名字的情况下,通过修改位不同的Storage Account来解决了当前问题。

 

参考资料

AZFD0004:主机 ID 冲突:https://learn.microsoft.com/zh-cn/azure/azure-functions/errors-diagnostics/diagnostic-events/azfd0004#event-description

Host ID: https://learn.microsoft.com/zh-cn/azure/azure-functions/storage-considerations?tabs=azure-cli#host-id-considerations

相关文章
【Azure Function】Function App门户上的Test/Run返回错误:Failed to fetch
Running your function in portal requires the app to explicitly accept requests from https://portal.azure.cn. This is known as cross-origin resource sharing (CORS).Configure CORS to add https://portal.azure.cn to allowed origins.
|
19天前
|
C#
【Azure Function】Function App出现System.IO.FileNotFoundException异常
Exception while executing function: xxxxxxx,The type initializer for 'xxxxxx.Storage.Adls2.StoreDataLakeGen2Reading' threw an exception. Could not load file or assembly 'Microsoft.Extensions.Configuration, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the
113 64
【Azure Function】C#独立工作模式下参数类型 ServiceBusReceivedMessage 无法正常工作
Cannot convert input parameter 'message' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'.
111 73
【Azure Function】部署Java Function失败:报错deploy [ERROR] Status code 401和警告 'China North 3' may not be a valid region
1:deploy [ERROR] Status code 401, (empty body). 2: China North 3 may not be a valid region,please refer to https://aka.ms/maven_function_configuration#supported-regions for values. 3:  <azure.functions.maven.plugin.version>1.36.0</azure.functions.maven.plugin.version>
38 11
【Azure Function】FTP上传了Python Function文件后,无法在门户页面加载函数的问题
通过FTP上传Python Function至Azure云后,出现函数列表无法加载的问题。经排查,发现是由于`requirements.txt`中的依赖包未被正确安装。解决方法为:在本地安装依赖包到`.python_packages/lib/site-packages`目录,再将该目录内容上传至云上的`wwwroot`目录,并重启应用。最终成功加载函数列表。
【Azure Function】Python Function部署到Azure后报错No module named '_cffi_backend'
ERROR: Error: No module named '_cffi_backend', Cannot find module. Please check the requirements.txt file for the missing module.
110 2
|
6月前
|
【Azure Function】发布 Python Function 到 Azure 成功,但是无法显示Function列表
【Azure Function】发布 Python Function 到 Azure 成功,但是无法显示Function列表
|
6月前
|
C#
【Azure Function】Function App启动时出现 Failed to open local port 4001 错误,这是什么情况呢?
【Azure Function】Function App启动时出现 Failed to open local port 4001 错误,这是什么情况呢?
|
6月前
|
【Azure Function】在VS Code中创建Function项目遇见 No .NET worker runtimes found
【Azure Function】在VS Code中创建Function项目遇见 No .NET worker runtimes found

热门文章

最新文章