Windows – Console application scheduled task not exiting some times on Windows Server 2008 R2

scheduled-taskwindowswindows-server-2008-r2

I have a C# console application as a Scheduled Task on Windows Server 2008 R2. The application is scheduled in Windows Task scheduler to run after every 15 minutes. At the end of the application I have,

Logger.Log("Killing app");
Environment.Exit(0);

Sometimes(may be once a month), my application do not exit. When I check my application log file I am seeing the Killing app message. I am sure that there is no eror and no crash. Just the application is not exiting. When I check the Task Scheduler, I see 0xC000013A in the Last Run Result. Since it is not exiting, it stop my job to run next time. In the same time(with a difference of ten minute), I see this message on Events Log,

The description for Event ID 0 from source gupdate cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event: 

Service stopped

I don't even know whether they are related or not.

Best Answer

No, they're not related. The event log message you've noticed relates to Google Update Service scheduled tasks, it spams the event log and no full event description is included.

Since it is not exiting, it stop my cron job to run next time

Investigate the scheduled task options for handling a task that overlaps the subsequent invocation:

enter image description here