永远在线应用程序服务计划上的Azure功能超时,但未设置功能超时设置 [英] Azure Function on Always-On App Service Plan Times Out with No functionTimeout Set

查看:150
本文介绍了永远在线应用程序服务计划上的Azure功能超时,但未设置功能超时设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像标题中描述的那样-我在App Service Plan上具有Azure功能,配置为Always On,并且在host.json中未设置functionTimeout,并且它似乎超时/在30分钟到1小时后都没有完成((...但我认为这可能是误报...)

Like the title describes - I have an Azure Function on the App Service Plan, configured for Always On and no functionTimeout set in my host.json, and it appears to timeout / not finish anytime after 30 minutes to 1 hour.(...but I feel this may be a false positive...)

HTTP触发功能有时可能需要1-2个小时以上才能完成.根据 Azure函数最佳做法我应该将其分解为更小/更易于管理的部分-我明白了.但是,我希望App Service计划上的Function能够像宣传的那样工作-对执行时间没有硬性限制.也许这与在应用程序服务上发生意外的天蓝色函数超时问题相同-plan ,但没有答案,我改用HTTP触发器.

The HTTP Triggered function can sometimes take over 1-2 hours to complete. I understand that this probably isn't the best design and according to the Azure Function Best Practices I should break this out into smaller / more manageable pieces - I get that. However, I expect the Function on the App Service plan to work as advertised - no hard limit on execution time. Perhaps this is the same question as Unexpected azure-function timeouts on app-service-plan, but that has no answer and I am using an HTTP Trigger instead.

当前,HTTP触发方法在工作完成之前不会返回. (这是一个问题-HTTP触发器需要更快地返回吗?)

Currently, the HTTP Triggered method does not return until the work is complete. (Is this a problem - the HTTP trigger needs to return quicker?)

根据Kudu函数调用日志,此案例报告未完成",当我单击切换输出"按钮以查看日志时,它们永远不会进入.

According to the Kudu Function Invocation Logs, this case reports "Never Finished", and when I click on the Toggle Output button to view the logs, they never come in.

当我查看该函数在该触发器的日志"部分中运行时,似乎该函数刚刚停止,并且日志流仅报告没有新的跟踪记录:

When I viewed this function's run in the Logs section of that trigger, it seems like the function just stopped, and the log stream just reports no new trace:

2017-07-26T16:36:43.116 [INFO] [Class1] Update operation started processing 790 sales records ... 2017-07-26T16:36:43.116 [DBUG] [Class2] Matching and updating ids from the map... 2017-07-26T16:38:07 No new trace in the past 1 min(s). 2017-07-26T16:39:07 No new trace in the past 2 min(s). 2017-07-26T16:40:07 No new trace in the past 3 min(s). 2017-07-26T16:41:07 No new trace in the past 4 min(s).

2017-07-26T16:36:43.116 [INFO] [Class1] Update operation started processing 790 sales records ... 2017-07-26T16:36:43.116 [DBUG] [Class2] Matching and updating ids from the map... 2017-07-26T16:38:07 No new trace in the past 1 min(s). 2017-07-26T16:39:07 No new trace in the past 2 min(s). 2017-07-26T16:40:07 No new trace in the past 3 min(s). 2017-07-26T16:41:07 No new trace in the past 4 min(s).

因此不确定该功能为何似乎停止了-或它停止了收集日志语句(有很多),并且由于某种原因,该功能从未完成.

So not sure why this function just seemed to stop - or perhaps it stopped collecting log statements (there are many), and for some reason, the function never completed.

有什么想法吗?

大约时间::2017-07-26T16:00:00 UTC InvocationID::d856c107-f1ee-455a-892b-ed970dcad128(我认为?)

Approx time: 2017-07-26T16:00:00 UTC InvocationID: d856c107-f1ee-455a-892b-ed970dcad128 (I think?)

如果确实超时,我们有什么办法可以知道((异常?App Insights?等)

If it is indeed being timed out, is there any way for us to know, (Exception? App Insights? etc.)

推荐答案

如果您的HTTP方法耗时超过一分钟,则应将其卸载到队列中.时期. (我知道其他答案已经说过了,但是值得重复).

If your HTTP method takes more than a minute, you should be offloading it to a Queue. Period. (I know the other answers have said this, but it's worth repeating).

  1. Http连接是有限的资源.
  2. 虽然Azure函数作为执行引擎可以处理长时间运行 操作(如队列/服务总线支持所示), http管道可能会中断/超时长时间运行的请求.
  1. Http connections are a limited resource.
  2. While Azure Functions as an execution engine can handle long running operations (as demonstrated by queue / service bus support), the http pipeline may cut off / timeout long running requests.

队列触发器可以轻松运行30分钟以上.如果您的工作时间长于此,则应该将其拆分为多个队列消息.

Queue triggers can easily run for 30+ minutes. If your job is longer than that, you really should split it into multiple queue messages.

也请查看耐用功能支持: https://github.com/Azure/azure-functions-durable-extension/

Also check out Durable Function support: https://github.com/Azure/azure-functions-durable-extension/

这篇关于永远在线应用程序服务计划上的Azure功能超时,但未设置功能超时设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆