My exe is abruptly closed and i get an error with code 2147750687 in task scheduler

89 views
0

I have a task set to run every 10 mins daily in a prod environment. The machine is Windows Server 2008 R2 Standard 64 bit system. The task basically runs an exe that process some XML files, transform them and put it in a different folder. Recently I saw that some XML files failed, the log file just ended abruptly. We tried to replicate and most of the common exception was caught. So we knew it was not an exception because the application would have caught it, logged it and ended gracefully. This seemed more like when you end the application in task manager and the log just stopped.

As part of the analysis I found that whenever the file failed, there was a warning and an error entry in task scheduler log.

https://ibb.co/fPEtzm

The warning states:
Task Scheduler did not launch task “Task name” because instance “{41a1167e-2092-434f-80e4-ef83e03fc7e1}” of the same task is already running.

The error states:
Task Scheduler failed to start “Task name” task for user “domainaccount”. Additional Data: Error Value: 2147750687.

The task is getting triggered at intervals of 10 minutes. So at the 10th minute, it gets triggered and instead of waiting for the running instance to get over, it crashes that thread even though we had set ‘Do not start new instance’ in the settings. An online search led me to this hotfix:

https://support.microsoft.com/en-us/help/2617046/duplicate-triggers-are-generated-incorrectly-in-sch

The symptom described is exactly what I am facing but the symptom says that this occurs when 2305420 is installed. I checked the updates installed in the system and it doesn’t hdoesn’t05420 installed. Can this issue occur even though KB2305420 is not installed? Can I run the hotfix to solve this issue? Is there any way to verify that this is indeed the issue? Is there a workaround for this? I read we can try creating a new task and delete the old one

Update:
I tried to replicate this in a test server but eventhough i get the error, the files are being processed properly by the exe and it finishes running as expected

Task:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2015-06-26T14:48:14.8148857</Date>
    <Author>author</Author>
    <Description>The task duration is set to establish a quiet period from 1:15 AM to 3:00 AM.</Description>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <Repetition>
        <Interval>PT10M</Interval>
        <Duration>PT21H30M</Duration>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2015-06-26T03:11:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>ID</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>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>"C:Program FilesTransform.exe"</Command>
      <Arguments>"C:Program FilesSTND.ini"</Arguments>
    </Exec>
  </Actions>
</Task>

System Info:
https://ibb.co/iskGKm