28

We have an Azure web site with a daily scheduled job. In our case, the scheduled job runs a stored procedure that takes about 10 minutes so there is no local processing. Our web job is terminating after about 4 minutes with this error.

Command 'cmd /c ...' aborted due to no output and CPU activity for 121 seconds.
You may increase SCM_COMMAND_IDLE_TIMEOUT setting to solve the issue.

We've tried adding the following app settings to the web job's app.config file:

<appSettings>
    <add key="SCM_COMMAND_IDLE_TIMEOUT" value="100000" />
    <add key="WEBJOBS_IDLE_TIMEOUT" value="100000" />
</appSettings>

Those files are referenced in this document https://github.com/projectkudu/kudu/wiki/Web-jobs but they don't seem to have any effect. (still timing out after adding the settings to the app.config file)

Are we adding the configuration settings to the right place?

Thanks for the help.

Ender2050
  • 6,912
  • 12
  • 51
  • 55
  • 10
    Instead of adding it to the app.config, try logging into the management portal and adding the `SCM_COMMAND_IDLE_TIMEOUT` app setting to the configure tab. (Can also do this via Visual Studio by right-clicking the website in Server Explorer and selecting View Settings). – Anthony Chu Oct 27 '14 at 21:47
  • Ok, this does work - thanks. But I need to find a way to get it checked into source control and working through the .config files. Do you know if the settings should be configured for the website or the web job? – Ender2050 Oct 28 '14 at 00:31
  • You can't have a committed file for this configuration, you can open a feature request for this here: https://github.com/projectkudu/kudu/issues as a workaround try Console.WriteLine(".") every minute. – Amit Apple Oct 28 '14 at 19:07
  • @AmitApple Is it still the case that we cannot set this in a configuration file? i.e. the .deployment file? – Esben Skov Pedersen Mar 24 '15 at 09:51
  • Yes, if you need this please open an issue - https://github.com/projectkudu/kudu/issues – Amit Apple Mar 24 '15 at 17:30
  • 1
    @Ender2050, I know this is old but wanted to make sure that you're aware of ARM templates. You can include the SCM_COMMAND_IDLE_TIMEOUT as a setting within your Web App's ARM template, and then check the template into source control. Let me know if you need more details. – Rob Reagan May 23 '17 at 19:27

3 Answers3

20

You need to set SCM_COMMAND_IDLE_TIMEOUT from the portal to your desired timeout value in seconds. For example, set it to 3600 for a one hour timeout.

Go to your website's config section, find the app settings section, and add the setting.

Zain Rizvi
  • 23,586
  • 22
  • 91
  • 133
19
  1. Login to Microsoft Azure portal

  2. Go to App Services,

  3. Select your website

  4. Go to settings --> Application settings tab

  5. Create a key “WEBJOBS_IDLE_TIMEOUT” under App settings section

  6. Save

youngseagul
  • 347
  • 5
  • 16
  • What do you put for the Value? – LatentDenis Oct 20 '16 at 20:06
  • 2
    You have to put value in seconds, best option is that you put that interval of time after which web job will run again , so that web job should not crash in the time of waiting. Suppose your web job runs after each hour then put 3600 in text box of value. – youngseagul Oct 21 '16 at 13:50
  • Having the same issue. Tried above steps but my points is - Is it good idea to keep it Running state. I mean if we give 3600 seconds, the web job is in running state. but the job done or the execution time is 10 mins. – chaitanyasingu Feb 16 '22 at 10:24
3

As this is the first stack overflow error that comes up when searching for the timeout problem i want to update it from my perspective;

If expecting a CONTINUOUS webjob, this isn't something that happens by default (Even though the webjob appears to run by the rules until timeout). This is something that has to be selected in the Visual Studio Publish properties as detailed here:

https://learn.microsoft.com/en-us/azure/app-service/webjobs-dotnet-deploy-vs

Once continuous is selected and the webjob is published, this error goes away

Mark G
  • 332
  • 3
  • 12