I have a scheduled task that is configured to be killed 23 hours after starting. When I export the task to XML I can verify this setting because I see the line:


However, the task is actually being killed after 20 hours.

The task starts at 6PM every day. Looking at the task history, I see that TaskScheduler terminated the task "due to timeout reached" at 2:00:01PM the following day. Of course it should have terminated at 5PM if it did not finish before then on its own.

How can I make the change in setting really take effect?

I tried exporting the task to XML, then deleting it, and reimporting from XML. This did not work, for one thing, the history tab still shows all the old events for the (deleted) task; it's like it was not fully deleted.

I also just disabled the task and reimported it from XML under another name. That new task also failed after 20 hours. Setting the interval to 24 hours (to see if it is killed after 21) does not work, it still terminates after 20 hours. Similarly setting the timeout to the equivalent number of seconds (to 23 hours) also times out after 20 hours.

This is on windows server 2008 R2 Enterprise Service Pack 1. This seems like a serious bug. Unfortunately, upgrading to server 2012 is not an option in the short term.

Here is the task definition exported to XML (yes, those funny characters at the beginning were there in the original). In this case I had set the timeout to 1435 minutes and it is rendered below as 23 hours and 55 minutes.

��<?xml version="1.0" encoding="UTF-16"?> <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <RegistrationInfo> <Date>2015-08-12T19:02:20.0562727</Date> <Author>MOSCATO2\Administrator</Author> </RegistrationInfo> <Triggers> <CalendarTrigger> <StartBoundary>2015-08-12T18:00:00</StartBoundary> <ExecutionTimeLimit>PT20H</ExecutionTimeLimit> <Enabled>true</Enabled> <ScheduleByWeek> <DaysOfWeek> <Sunday /> <Monday /> <Tuesday /> <Wednesday /> <Thursday /> <Saturday /> </DaysOfWeek> <WeeksInterval>1</WeeksInterval> </ScheduleByWeek> </CalendarTrigger> </Triggers> <Principals> <Principal id="Author"> <UserId>MOSCATO2\biocbuild</UserId> <LogonType>Password</LogonType> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>PT23H55M</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>E:\biocbld\BBS\3.3\bioc\moscato2\run.bat</Command> <Arguments>&gt;&gt; e:\biocbld\bbs-3.3-bioc\log\MOSCATO2.log 2&gt;&amp;1</Arguments> <WorkingDirectory>E:\biocbld\BBS\3.3\bioc\moscato2</WorkingDirectory> </Exec> </Actions> </Task>


The Trigger ExecutionTimeLimit has priority over the Task ExecutionTimeLimit.


If both are specified, the Task time limit is traditionally set to a higher (or equal) value.

TBH, there really should be some kind of visible warning alerting you if a task is configured this way.


You have 2 ExecutionTimeLimit

1 in triggers set to ExecutionTimeLimit-PT20H-ExecutionTimeLimit

1 in settings set to ExecutionTimeLimit-PT23H55M-ExecutionTimeLimit

Change them to be the same and it should be OK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.