始终在线应用服务计划上的 Azure 函数超时且未设置 functionTimeout [英] Azure Function on Always-On App Service Plan Times Out with No functionTimeout Set
问题描述
如标题所述 - 我在应用服务计划中有一个 Azure 函数,配置为始终开启,并且在我的 host.json
中没有设置 functionTimeout
,它出现了在 30 分钟到 1 小时后随时超时/未完成.(...但我觉得这可能是误报...)
HTTP 触发功能有时可能需要 1-2 小时才能完成.我知道这可能不是最好的设计,并且根据
当我在该触发器的日志部分查看此函数的运行时,似乎该函数刚刚停止,并且日志流只是报告没有新的跟踪:
2017-07-26T16:36:43.116 [INFO] [Class1] 更新操作开始处理 790 条销售记录...2017-07-26T16:36:43.116 [DBUG] [Class2] 匹配和更新地图中的 id...2017-07-26T16:38:07 在过去 1 分钟内没有新的踪迹.2017-07-26T16:39:07 在过去 2 分钟内没有新的踪迹.2017-07-26T16:40:07 在过去 3 分钟内没有新的踪迹.2017-07-26T16:41:07 在过去 4 分钟内没有新的踪迹.
所以不知道为什么这个函数似乎停止了——或者它可能停止收集日志语句(有很多),并且由于某种原因,该函数从未完成.
有什么想法吗?
大约时间: 2017-07-26T16:00:00 UTCInvocationID: d856c107-f1ee-455a-892b-ed970dcad128(我认为?)
如果确实超时,有什么方法可以让我们知道(异常?App Insights?等)
如果您的 HTTP 方法花费的时间超过一分钟,您应该将其卸载到队列中.时期.(我知道其他答案已经说过这一点,但值得重复).
- Http 连接是一种有限的资源.
- 虽然 Azure Functions 作为执行引擎可以处理长时间运行操作(如队列/服务总线支持所示),http 管道可能会中断/超时长时间运行的请求.
队列触发器可以轻松运行 30 多分钟.如果你的工作比这更长,你真的应该把它分成多个队列消息.
还可以查看持久功能支持:https://github.com/Azure/azure-functions-durable-extension/
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...)
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.
Currently, the HTTP Triggered method does not return until the work is complete. (Is this a problem - the HTTP trigger needs to return quicker?)
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).
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.
Any ideas?
Approx time: 2017-07-26T16:00:00 UTC InvocationID: d856c107-f1ee-455a-892b-ed970dcad128 (I think?)
If it is indeed being timed out, is there any way for us to know, (Exception? App Insights? etc.)
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).
- Http connections are a limited resource.
- 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.
Queue triggers can easily run for 30+ minutes. If your job is longer than that, you really should split it into multiple queue messages.
Also check out Durable Function support: https://github.com/Azure/azure-functions-durable-extension/
这篇关于始终在线应用服务计划上的 Azure 函数超时且未设置 functionTimeout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!