DavidMarino-1836 avatar image
0 Votes"
DavidMarino-1836 asked DavidMarino-1836 commented

Windows Server 2016: Task Scheduler "Launch task ... same task is already running"

Environment: VM Windows server 2016, x64 base, 8GB Mem
Utility App: Console .Net 4.6.1
App Function: Alerts if files not received on time; otherwise it does nothing
Task Job Configuration: Runs every hour (11 minutes after the hr.) / indefinitely, all week
Task is run under a Service ID with the highest privileges
Task is configured to force stop after 30 minutes; this job doesn't run more than 2 minutes.

  1.     I consistently see "Launch" errors due the system "seeing" an instance of the job already running. 

a. I logged on with the Service ID, and via the Task Mgr. I saw the .EXE come into view and disappeared after 2 minutes. This is the expected results.
b. The Task history indicates that job completes successfully.
c. In the code, I explicitly relinquished all resources and explicitly exited the app; System.Environment.Exit(0) to see if this made any difference; it did not.
d. I deleted the task on the test server, and created it again with the same name. The system saw the previous task iteration’s history
e. This issue seemed to manifested after we moved to Server 2016 from 2008 R2
f. Since this is an innocuous app, I moved it to prod, creating the task job from scratch. Test & Prod server are similarly created. The issue started to appear after 24 hours in prod
g. Only two tasks in PROD exhibit this system, and they have 2 different code base
As far as I can tell the app is functioning as expected despite the "Launch" errors. Although due to how the app works, I’m not 100% sure that the app was active to determine whether or not the files were in the folder. I’m considering to set the task scheduler kill the running instance as a work around, but I would like to get to the root of the issue.

1. I'm not a server admin, I'm in an application support / dev role. The server admin dept. was kind enough to leave me to my own devices to solve this issue
2. I have the same issue on the test server, but the code doesn’t explicitly exit the app. I'm not sure if this is the right forum, but the MS forum seem to indicate this is the forum for Task Scheduler issues.

I greatly appreciate any guidance on how best go about troubleshooting this issue.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

CarlFan-MSFT avatar image
0 Votes"
CarlFan-MSFT answered DavidMarino-1836 commented

It may happen that a task that runs as scheduled task simply does not terminate. Try changing few options in task scheduler to check.
Please refer to the information below.
Hope this helps and please help to accept as Answer if the response is useful.
Best Regards,

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for the guidance.
I had set the "stop the running instance" flag, but I have changed it to "run in parallel" as recommended in the link and other posts.

Prior to the updating the task, I noticed that the task resumed running normally, i.e. no "Launch" issues. In addition, my app continues to work as expected. Which leads me to think that the problem(s) lies somewhere in the MS ecosystem.

I am concern that having eliminated my app as the culprit (having explicitly released resources and purposely exited the application), there doesn't seem to be a viable troubleshooting methodology to get to the root of the problem on the MS side. Reading through a variety of posts, there appears to be more work arounds than solutions.

Again, thank you for your help.


0 Votes 0 ·