Solved

windows server enterprise sp2   task scheduler kicks off same task multiple times

Posted on 2012-04-03
16
1,068 Views
Last Modified: 2012-05-15
we have a task that runs every 30 minutes to check for a file to import.

as you can see from the attachment, there are 4 instances of the task that start all at exactly the same time, with different correlation ID.
all but 1 of them fail with "task already running"

the end result is that only 1 task gets run and it runs at the right time.. but......

why does it kick off multiple tasks!!!
makes looking through the history tedious.
tia
task-scheduler.png
0
Comment
Question by:CASorter
  • 9
  • 7
16 Comments
 
LVL 7

Expert Comment

by:rsimsee
ID: 37820582
I don't know what your task is doing, but do you have the auto kill after a specified amount of time option set?  Do you know for certain it's ending / stopping?
0
 

Author Comment

by:CASorter
ID: 37822571
it is running an import program, which parses and processes a text file.

yes the first task stops when it is finished.   the issue is that at the exact same time, it kicks off 3-4 of the same task
0
 
LVL 7

Expert Comment

by:rsimsee
ID: 37823141
Well, the obvious question here is why is it launching multiple times at once.

Maybe it is finishing *too* quickly?  It's possible that if it starts at 2:30 and finishes in such a really short amount of time that it auto starts it again because it is still in the launch window.  Try adding a command to your file to waste some time.

If you're running a .cmd (batch) file, you can try adding a command to waste a few seconds.  There's not actual command to do this in stock cmdese but you can put something in like "ping 192.168.254.1 -n 1 -w 60000" which will basically sit and wait for 60 seconds while it tries to ping a non-existant ip address.  (This assumes you don't have a 192.168.254.1 somewhere on your network :) )
0
 

Author Comment

by:CASorter
ID: 37823810
it runs for 40-50 minutes.  And the switch to not start a new one if this is one is still running is turned on, but when it kickes in on the half hour...   it tries and start 3-5 more tasks, all of which fail because the first one is still running.

i am *thinking* that it might be that if i edit the task, it somehow keeps the previous version "live"....

i am thinking of deleting and re creating the task.
0
 
LVL 7

Expert Comment

by:rsimsee
ID: 37823893
That's exactly what I was getting to in my first post...  If you have a task that runs for 40-50 mins, and you try to start it again in 30 mins, it's going to fail.  Of course, it only takes a very short time to realize that it has failed, so it finishes and returns while it is still in it's launch window, and so it tries to run it again, which also fails and returns.  It apparently can launch, fail, and return about 3-4 times before the launch window expires.

As far as not starting a new one if the current one is still running, I'm not familiar with that option, and from what you describe it doesn't sound like it's working - where do you have that set and what exactly is it called?

Again, I don't know your requirements as to how often your import file must be parsed, but I would try extending the restart time to a value you know won't overrun the run time of a parsing script and see if it runs as you expect.
0
 

Author Comment

by:CASorter
ID: 37823945
it is supposed to detect if the scheduled job is still running(see attached pic) and if it is, dont start a new one.   i EXPECT to see 1(ONE) failure of a start if it tries to run again while it the initial scheduled task is still running.

what i am seeing is 3-5 attempts to start a new task all at the exact same time.

it seems like it should detect or know that the task is already running before i even tries to start up another one.....
nonewstart.png
0
 
LVL 7

Expert Comment

by:rsimsee
ID: 37824026
The 3-5 attempts is because of how fast it's happening.  If you have a task that is set to run at 2:30, and it starts, fails, and returns in 15 seconds, it is *still* 2:30 when it comes back to task scheduler, so task scheduler will start it again.  It will continue to do this until 2:31:

2:30.0     Runs Task - Fails
2:30.15   Runs Task - Fails
2:30.30   Runs Task - Fails
2:30.45   Runs Task - Fails
2:31.0     Out of Launch Window

Perhaps the system is not detecting the task is still running because you have kicked off another process in your task, and the initial process is completed in time?

Either way, you can extend the relaunch time, or, if you are ok with the 1 failure but not 3-5, you can put a statement in your event that waits 1 minute before returning.  If you're using a .cmd file you can do something like "Ping 192.168.254.1 -n 1 -w 600000" which will make it count to 60 before ending.
0
 

Author Comment

by:CASorter
ID: 37839190
not buying it.

the first run, it should start.  period.  

your scenario isnt quite right.

this is what happens
2:30.0     Runs Task - starts successfully  and will keep running for 40 minutes or more.
2:30.0  tries to start another instance of the same task - Fails because instance 1 is running successfully
2:30.0  tries to start  another instance of the same task - Fails because instance 1 is running successfully
2:30.0  tries to start  another instance of the same task - Fails because instance 1 is running successfully

3:00 tries to start task - Fails because instance 1 is running successfully
3:00 tries to start task - Fails because instance 1 is running successfully
3:00 tries to start task - Fails because instance 1 is running successfully
3:00 tries to start task - Fails because instance 1 is running successfully

3:30 tries to start task - Fails because instance 1 is running successfully
3:30 tries to start task - Fails because instance 1 is running successfully
3:30 tries to start task - Fails because instance 1 is running successfully
3:30 tries to start task - Fails because instance 1 is running successfully

3:33 task finishes.


this is what i would expect to happen

2:30.0     Runs Task - starts successfully  and will keep running for 40 minutes or more.

3:00 tries to start task - Fails because instance 1 is running successfully

3:30 tries to start task - Fails because instance 1 is running successfully

3:33 task finishes.
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 7

Expert Comment

by:rsimsee
ID: 37839240
What is the format of your task?  (cmd or an executable?)
0
 

Author Comment

by:CASorter
ID: 37839669
an executable   .exe
0
 

Author Comment

by:CASorter
ID: 37839680
... and on top of all that..   now none of the history is showing at all in the history tab.  

the jobs are all still running, but the history is not showing.

more specifically,    the history stopped being updated.   the old history records are there, i can see them..  

just no new ones are being added.  for ANY jobs in the list

but the jobs are running




gaaarrrr
0
 
LVL 7

Expert Comment

by:rsimsee
ID: 37839722
Just as a test, make a .cmd file and replace the .exe file with it....

ping 192.168.254.1 -n 1 -w 60000
<your exe file>

See if it gets rid of the duplicate runs.
0
 

Author Comment

by:CASorter
ID: 37839732
... i cant tell if it works now because NONE of the history records are showing.


i will try it when we reboot the server.
(which *might* fix the problem anyway)
0
 
LVL 7

Accepted Solution

by:
rsimsee earned 500 total points
ID: 37839737
Well, when in doubt reboot it out is one of my favorite sayings...
0
 

Author Comment

by:CASorter
ID: 37839744
question 1 with trouble shooting

Is it plugged in?

question 2

have  you rebooted?

i will keep you posted.
0
 

Author Comment

by:CASorter
ID: 37970276
after reboot.   it is still doing it.

i am not that concerned, because the result is what is desired.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On a regular basis I get questions about slow RDP performance, RDP connection problems, strange errors and even BSOD, remote computers freezing or restarting after initiation of a remote session. In a lot of this cases the quick solutions made b…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now