0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AzureのWebジョブでaborted due to no output nor CPU activity for 121 seconds.が発生した時の対処方法

0
Last updated at Posted at 2020-12-11

Azure の Webジョブを稼働させているとき、稀にエラーで終了しているときがあります。

Azure ポータルで確認するとこんな感じ。
20201211-00.png

上の画面からログを押して、エラーの状況を確認するとメッセージは以下のような感じで、ようするに
「121 秒の間 CPU を使わずアイドル状態だったので終了させましたよ」
というもの。

Error.log
[12/08/2020 14:11:56 > be9f97: ERR ] Command 'cmd /c ""XXXXXX ...' 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 ""XXXXX.exe""
[12/08/2020 14:11:56 > be9f97: SYS INFO] Status changed to Failed
[12/08/2020 14:11:56 > be9f97: SYS ERR ] System.AggregateException: One or more errors occurred. ---> Kudu.Core.Infrastructure.CommandLineException: Command 'cmd /c ""XXXXX ...' 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 ""XXXXX.exe""
   at Kudu.Core.Infrastructure.IdleManager.WaitForExit(IProcess process) in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\IdleManager.cs:line 96
   at Kudu.Core.Infrastructure.ProcessExtensions.<Start>d__13.MoveNext() in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\ProcessExtensions.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.<ExecuteAsync>d__31.MoveNext() in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\Executable.cs:line 255
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Kudu.Core.Infrastructure.Executable.ExecuteInternal(ITracer tracer, Func`2 onWriteOutput, Func`2 onWriteError, Encoding encoding, String arguments, Object[] args) in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\Executable.cs:line 216
   at Kudu.Core.Infrastructure.Executable.ExecuteReturnExitCode(ITracer tracer, Action`1 onWriteOutput, Action`1 onWriteError, String arguments, Object[] args) in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\Executable.cs:line 165
   at Kudu.Core.Jobs.BaseJobRunner.RunJobInstance(JobBase job, IJobLogger logger, String runId, String trigger, ITracer tracer, Int32 port) in C:\Kudu Files\Private\src\master\Kudu.Core\Jobs\BaseJobRunner.cs:line 272
---> (Inner Exception #0) ExitCode: -1, Output: Command 'cmd /c ""XXXXX ...' 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 ""XXXXX ...' 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 ""XXXXX ...' 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 ""XXXXX.exe""
   at Kudu.Core.Infrastructure.IdleManager.WaitForExit(IProcess process) in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\IdleManager.cs:line 96
   at Kudu.Core.Infrastructure.ProcessExtensions.<Start>d__13.MoveNext() in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\ProcessExtensions.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.<ExecuteAsync>d__31.MoveNext() in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\Executable.cs:line 255<---

確かに15秒程度の Thread.Sleep はあるのだが、121 秒もアイドルなことはないと思うけど....

でもなぜか不定期に発生する。

で、対応としては上のメッセージにもあるように WEBJOBS_IDLE_TIMEOUT を設定してタイムアウト値を延ばす。

Webジョブが稼働する App Service を開き、構成+新しいアプリケーション設定 を選択。
名前:WEBJOBS_IDLE_TIMEOUT
値:秒を指定(例では 3,600 = 1 時間)
を入力して OK
20201211-01.png

その後、保存 を選択すると

アプリケーション設定と接続文字列を変更すると、アプリケーションが再起動します。続行しますか?

と聞かれるので続行を選択。

注意点は、これで設定した App Service 全体が再起動となるのだが、App Service そのものは再起動されるが、配下で稼働している Web ジョブは停止したままとなるので必要に応じて手動で起動が必要なこと。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?