Azure 函数主机自动停止且不重新启动

标签 azure function restart azure-triggers

我在多个 Azure 函数应用程序中看到主机定期停止并自动重新启动。 一周以来,我的 Azure 函数应用程序停止运行,但我需要手动重新启动主机。

在 ApplicationInsights 中运行以下查询:

traces 
| where message == "Job host stopped" or message == "Job host started"
| order by timestamp asc

snippet from traces

  • 2022 年 1 月 23 日 20:08:42.436 作业主机已启动
  • 2022 年 1 月 23 日 20:09:25.668 作业主机已停止
  • 2022 年 1 月 23 日 21:08:48.800 作业主机已启动
  • 2022 年 1 月 23 日 21:11:33.702 作业主机已停止
  • 2022 年 1 月 23 日 22:17:03.286 作业主机已停止
  • 2022 年 1 月 23 日 22:18:39.002 作业主机已启动
  • 2022 年 1 月 23 日 23:10:31.580 作业主机已停止
  • 2022 年 1 月 24 日 06:41:48.024 作业主机已启动
  • 2022 年 1 月 24 日 06:42:44.680 作业主机已停止
  • 2022 年 1 月 24 日 06:43:00.902 作业主机已启动
  • 2022 年 1 月 24 日 07:10:52.220 作业主机已停止

2022 年 1 月 24 日 06:41 开始是由于手动重启我的函数应用。在此停止期间没有执行任何时间触发器。这种情况每天都会发生不止一次。没有模式。

有什么想法吗?事件日志没有用,在自动停止和手动重启之间没有日志记录。

如何解决这个问题?为什么该功能如此频繁地重新启动?

更新:手动触发器 (http) 正在重新启动主机。

最佳答案

早上好,约翰。

如果您的主机永久停止:

try checking app_offline.html file within your project.

for more detailed info: https://www.codit.eu/blog/why-is-my-azure-function-host-permanently-stopped/

如果您的问题与主机连续启动和停止有关:

这种行为可能与您的计划有关,我认为您的Azure功能中有一个消费计划。

Consumption plan: On the Consumption plan, instances of the Functions host are dynamically added and removed based on the number of incoming events.

Premium plan: Your function apps run continuously, or nearly continuously.

Dedicated plan: Run your functions within an App Service plan at regular App Service plan rates.

For more info you can go to https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale

关于Azure 函数主机自动停止且不重新启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70830504/

相关文章:

node.js - 重启时Nodemon不执行命令

c# - Web 角色部署期间缺少 Microsoft.WindowsAzure.Diagnostics

javascript - 使用 Javascript 函数更改 CSS(压缩代码)

azure - 如何在Microsoft Azure上打开outline/shadowsocks服务器

python - 优化二叉树函数,霍夫曼树

c++ - 我应该更改函数参数的值吗?

linux - 在 linux 和 mac 中使用 JNA 或类似的方法关闭并重新启动计算机

exception - 常见的 lisp 异常处理(条件和重启)

c# - Azure DevOps API 在用户故事下创建任务

sql - Azure SQL - 空间性能问题