触发 Web 作业完全执行,然后在 121 秒后超时中止 [英] Triggered Web Job Executing Completely, and then Aborting with Timeout 121 seconds later

查看:28
本文介绍了触发 Web 作业完全执行,然后在 121 秒后超时中止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 webjob,当一个新项目添加到存储队列时,它在 Azure 中成功触发.

I have a webjob which is successfully being triggered in Azure when a new item is added to the storage queue.

当它被触发时,我检查了日志,所有编写的代码都已正确执行,但 Web 作业仍处于仍在执行"状态,并在执行 121 秒后中止.

When it is triggered, I check the logs and all the code written has executed properly, but the web job stays in a "still executing" state, and after 121 seconds after execution it aborts.

这是触发的方法,然后是日志文件,您可以看到开始处理内容"已写入日志,处理内容已完成"已写入日志.这告诉我一切都执行得很好,据我所知,我不需要做任何其他特别的事情来表明这已成功执行.

Here is the method that gets triggered followed by the log file where you can see "Start Processing Content" is written to the log and "Processing Content Has Completed" was written to the log. That tells me that everything executed fine, and as far as I know there isn't anything else special that I need to do to signal that this was successfully executed.

因此,我认为 Web 作业应该如何工作是这将被视为成功执行.相反,它在仪表板中被标记为失败"并完全停止 Web 作业(即使它被设计为在连续模式下工作).此外,应用服务设置为始终开启.

So, how I think Web Jobs are supposed to work is that this would be considered a successful execution. Instead it is marked as "Failed" in the dashboard and completely stops the web job (even though it is designed to work in continuous mode). Also, App Service is set to Always On.

错误中增加超时的建议毫无意义.所有要做的不是在完成后 121 秒超时,而是在完成后 5 分钟或我设置的任何时间超时.

The recommendations in the error to increase the timeout make no sense. All that would do is instead of timing out 121 seconds after completion, it would timeout 5 mins after completion or whatever I set it to.

对我来说,在作业甚至表明它已成功"之后,此超时将中止作业,这完全是倒退.(有关这些详细信息,请参阅我在下面的日志中加粗的所有要点).可能是一个错误?或者我自己错过了其他一些设置?还是 MS 缺少的另一份文档?

It's completely backwards to me that this timeout would abort the job after the job has even indicated it has "Succeeded". (See all the points I bolded the log below for those details). A bug maybe? Or some other missed setting by myself? Or another piece of absent documentation from MS?

应用服务计划在付费服务层 (B1) 上运行.

App Service Plan is running on a paid service tier (B1).

public static async Task ProcessQueueMessage([QueueTrigger("myTrigger")] CloudQueueMessage message, TextWriter log)
        {
                System.Console.Out.WriteLine($"Start Processing Content");
                await DoSomeWork();
                System.Console.Out.WriteLine($"Processing Content Has Completed");
   }

  • [06/24/2019 00:08:11 > 8a8d8d: INFO] 触发器详细信息:MessageId:086184dd-f9be-4e1d-b1e7-49707bd1a4e7, DequeueCount: 1, InsertionTime:2019/6/24 上午 12:07:48 +00:00[06/24/2019 00:08:11 > 8a8d8d: INFO] 开始处理内容 [06/24/2019 00:08:15 > 8a8d8d: INFO] 处理内容已已完成 [06/24/2019 00:08:15 > 8a8d8d: INFO] 信息:Function.ProcessQueueMessage[0] [06/24/2019 00:08:15 > 8a8d8d: INFO]
    执行StorageQueueProcessor.ProcessQueueMessage"(成功,Id=f3fcd403-515a-4746-803e-fba14d2b0455) [**06/24/2019 00:12:17 >8a8d8d: ERR ] **命令 'cmd/c ""run.cmd""' 由于没有输出或 CPU 活动持续 121 秒.您可以增加SCM_COMMAND_IDLE_TIMEOUT 应用程序设置(或 WEBJOBS_IDLE_TIMEOUT 如果此是一个 WebJob)如果需要. cmd/c ""run.cmd"" [06/24/2019 00:12:17 >8a8d8d:SYS INFO] 状态更改为失败 [06/24/2019 00:12:17 >8a8d8d:SYS ERR] System.AggregateException:一个或多个错误发生了.---> Kudu.Core.Infrastructure.CommandLineException:命令'cmd/c ""run.cmd""' 由于没有输出或 CPU 活动而中止121 秒.您可以增加 SCM_COMMAND_IDLE_TIMEOUT 应用设置(如果需要,则为 WEBJOBS_IDLE_TIMEOUT,如果这是 Web 作业).命令行/c""run.cmd"" 在Kudu.Core.Infrastructure.IdleManager.WaitForExit(IProcess 进程)中C:酷都FilesPrivatesrcmasterKudu.CoreInfrastructureIdleManager.cs:line96 在Kudu.Core.Infrastructure.ProcessExtensions.d__13.MoveNext() 中C:酷都FilesPrivatesrcmasterKudu.CoreInfrastructureProcessExtensions.cs:line254--- 从上一个抛出异常的位置开始的堆栈跟踪结束 --- 在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)在Kudu.Core.Infrastructure.Executable.d__31.MoveNext() 中C:酷都FilesPrivatesrcmasterKudu.CoreInfrastructureExecutable.cs:line255 --- 内部异常堆栈跟踪结束 --- 在System.Threading.Tasks.Task.ThrowIfExceptional(Boolean)includeTaskCanceledExceptions) 在System.Threading.Tasks.Task1.GetResultCore(Boolean等待完成通知)在Kudu.Core.Infrastructure.Executable.ExecuteInternal(ITracer 跟踪器,Func2 onWriteOutput, Func2 onWriteError, Encoding encoding, String参数,Object[] args) 在 C:KuduFilesPrivatesrcmasterKudu.CoreInfrastructureExecutable.cs:line216 在Kudu.Core.Infrastructure.Executable.ExecuteReturnExitCode(ITracertracer, Action1 onWriteOutput, Action`1 onWriteError, String参数,Object[] args) 在 C:KuduFilesPrivatesrcmasterKudu.CoreInfrastructureExecutable.cs:line165 在 Kudu.Core.Jobs.BaseJobRunner.RunJobInstance(JobBase 作业,IJobLogger 记录器、字符串 runId、字符串触发器、ITracer 跟踪器、Int32端口)在 C:KuduFilesPrivatesrcmasterKudu.CoreJobsBaseJobRunner.cs:line 272--->(内部异常 #0)ExitCode:-1,输出:命令 'cmd/c ""run.cmd""' 由于 121 没有输出或 CPU 活动而被中止秒.您可以增加 SCM_COMMAND_IDLE_TIMEOUT 应用设置(或WEBJOBS_IDLE_TIMEOUT 如果这是一个 WebJob)如果需要.,错误:命令'cmd/c ""run.cmd""' 由于没有输出或 CPU 活动而中止121 秒.您可以增加 SCM_COMMAND_IDLE_TIMEOUT 应用设置(如果需要,则为 WEBJOBS_IDLE_TIMEOUT,如果这是一个 WebJob),Kudu.Core.Infrastructure.CommandLineException: 命令 'cmd/c由于 121 没有输出或 CPU 活动,""run.cmd""' 被中止秒.您可以增加 SCM_COMMAND_IDLE_TIMEOUT 应用设置(或WEBJOBS_IDLE_TIMEOUT(如果这是一个 WebJob)如果需要.命令行/c""run.cmd"" 在Kudu.Core.Infrastructure.IdleManager.WaitForExit(IProcess 进程)中C:酷都FilesPrivatesrcmasterKudu.CoreInfrastructureIdleManager.cs:line96 在Kudu.Core.Infrastructure.ProcessExtensions.d__13.MoveNext() 中C:酷都FilesPrivatesrcmasterKudu.CoreInfrastructureProcessExtensions.cs:line254--- 从上一个抛出异常的位置开始的堆栈跟踪结束 --- 在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)在Kudu.Core.Infrastructure.Executable.d__31.MoveNext() 中C:酷都FilesPrivatesrcmasterKudu.CoreInfrastructureExecutable.cs:line255<---

    [06/24/2019 00:08:11 > 8a8d8d: INFO] Trigger Details: MessageId: 086184dd-f9be-4e1d-b1e7-49707bd1a4e7, DequeueCount: 1, InsertionTime: 6/24/2019 12:07:48 AM +00:00 [06/24/2019 00:08:11 > 8a8d8d: INFO] Start Processing Content [06/24/2019 00:08:15 > 8a8d8d: INFO] Processing Content Has Completed [06/24/2019 00:08:15 > 8a8d8d: INFO] info: Function.ProcessQueueMessage[0] [06/24/2019 00:08:15 > 8a8d8d: INFO]
    Executed 'StorageQueueProcessor.ProcessQueueMessage' (Succeeded, Id=f3fcd403-515a-4746-803e-fba14d2b0455) [**06/24/2019 00:12:17 > 8a8d8d: ERR ] **Command 'cmd /c ""run.cmd""' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed. cmd /c ""run.cmd"" [06/24/2019 00:12:17 > 8a8d8d: SYS INFO] Status changed to Failed [06/24/2019 00:12:17 > 8a8d8d: SYS ERR ] System.AggregateException: One or more errors occurred. ---> Kudu.Core.Infrastructure.CommandLineException: Command 'cmd /c ""run.cmd""' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed. cmd /c ""run.cmd"" at Kudu.Core.Infrastructure.IdleManager.WaitForExit(IProcess process) in C:Kudu FilesPrivatesrcmasterKudu.CoreInfrastructureIdleManager.cs:line 96 at Kudu.Core.Infrastructure.ProcessExtensions.d__13.MoveNext() in C:Kudu FilesPrivatesrcmasterKudu.CoreInfrastructureProcessExtensions.cs:line 254 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Kudu.Core.Infrastructure.Executable.d__31.MoveNext() in C:Kudu FilesPrivatesrcmasterKudu.CoreInfrastructureExecutable.cs:line 255 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Kudu.Core.Infrastructure.Executable.ExecuteInternal(ITracer tracer, Func2 onWriteOutput, Func2 onWriteError, Encoding encoding, String arguments, Object[] args) in C:Kudu FilesPrivatesrcmasterKudu.CoreInfrastructureExecutable.cs:line 216 at Kudu.Core.Infrastructure.Executable.ExecuteReturnExitCode(ITracer tracer, Action1 onWriteOutput, Action`1 onWriteError, String arguments, Object[] args) in C:Kudu FilesPrivatesrcmasterKudu.CoreInfrastructureExecutable.cs:line 165 at Kudu.Core.Jobs.BaseJobRunner.RunJobInstance(JobBase job, IJobLogger logger, String runId, String trigger, ITracer tracer, Int32 port) in C:Kudu FilesPrivatesrcmasterKudu.CoreJobsBaseJobRunner.cs:line 272 ---> (Inner Exception #0) ExitCode: -1, Output: Command 'cmd /c ""run.cmd""' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed., Error: Command 'cmd /c ""run.cmd""' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed., Kudu.Core.Infrastructure.CommandLineException: Command 'cmd /c ""run.cmd""' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed. cmd /c ""run.cmd"" at Kudu.Core.Infrastructure.IdleManager.WaitForExit(IProcess process) in C:Kudu FilesPrivatesrcmasterKudu.CoreInfrastructureIdleManager.cs:line 96 at Kudu.Core.Infrastructure.ProcessExtensions.d__13.MoveNext() in C:Kudu FilesPrivatesrcmasterKudu.CoreInfrastructureProcessExtensions.cs:line 254 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Kudu.Core.Infrastructure.Executable.d__31.MoveNext() in C:Kudu FilesPrivatesrcmasterKudu.CoreInfrastructureExecutable.cs:line 255<---

  • 推荐答案

    对于那些真正想习惯触发式工作的人,尝试更换

    For those who actually want use to a triggered job, try to replace

    host.Run(); by host.Start();

    在您的 Program.cs 中,它对我有用.

    in your Program.cs, it worked for me.

    这篇关于触发 Web 作业完全执行,然后在 121 秒后超时中止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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