thm*_*shd 5 .net azure azure-webjobs
与我的问题 60304305有点相关......我的 Azure webJob 应用程序处理多个队列,但它们不会产生高流量。尽管如此,该应用程序仍会不时遇到超时异常,并且几乎不可能重现该错误,但是在 Queue 函数内的断点处中断并保持一段时间时,我取得了一些成功。
System.TimeoutException
HResult=0x********
Message=The operation 'GetMessages' with id '********-****-****-****-************' did not complete in '00:02:00'.
Source=Microsoft.Azure.WebJobs.Extensions.Storage
StackTrace:
at Microsoft.Azure.WebJobs.Extensions.Storage.TimeoutHandler.<ExecuteWithTimeout>d__1`1.MoveNext() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Extensions.Storage\TimeoutHandler.cs:line 30
at Microsoft.Azure.WebJobs.Host.Timers.WebJobsExceptionHandler.<>c__DisplayClass3_0.<OnUnhandledExceptionAsync>b__0() in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Timers\WebJobsExceptionHandler.cs:line 54
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
This exception was originally thrown at this call stack:
Microsoft.Azure.WebJobs.Extensions.Storage.TimeoutHandler.ExecuteWithTimeout<T>(string, string, Microsoft.Azure.WebJobs.Host.Timers.IWebJobsExceptionHandler, System.Func<System.Threading.Tasks.Task<T>>) in TimeoutHandler.cs
Microsoft.Azure.WebJobs.Host.Timers.WebJobsExceptionHandler.OnUnhandledExceptionAsync.AnonymousMethod__0() in WebJobsExceptionHandler.cs
System.Threading.ThreadHelper.ThreadStart_Context(object)
System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, object, bool)
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, object, bool)
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, object)
System.Threading.ThreadHelper.ThreadStart()
Run Code Online (Sandbox Code Playgroud)
有趣的是,命名空间似乎是“Microsoft.Azure.WebJobs.Host。定时器”,但我不使用任何计时器,只有队列。此外,'00:02:00' 的超时时间很长。这些功能可以运行几个小时,但有时会失败。这里的大问题是:
我试图更新ServicePointManager.DefaultConnectionLimit到大量的建议在这里没有成功,尝试了多种不同的队列设置(BatchSize,MaxDequeueCount等从低变高的数字,也没有成功等等),我已经厌倦了不断尝试新东西,我需要找到更多信息,但我不知道如何。
我也有那些奇怪的错误,我也不知道它们来自哪里。不过,我找到了一种处理它们的方法:当主机关闭时,它被取消,你可以通过方法CancellationToken监视它的取消。Register
例如:
[FunctionName("MyFunction")]
public async Task ProcessMyQueueMessageAsync(
[QueueTrigger("myqueue")] MyQueueMessage payload,
ExecutionContext context, CancellationToken cancellationToken)
{
token.Register(async () =>
{
// your code to handle such an error, can be an async function
});
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
596 次 |
| 最近记录: |