Task Agent and StartUp Schedule

Behaviour observed in 10.2.600 and 10.2.700. When you have a Scheduled Item set for Startup if you restart your Task Agent, it won’t fire. If you stop and start your Task Agent within 1 minute, the same it won’t fire. You have to either way 1+ minutes before you start it again, or you blank out the NextRunOnDate… oddly enough Epicor sets it and sets it back to null after a successful 1+ min wait and Start of TA Service.

@JeffLeBert is this a built in timer that is meant to help truly identify restart vs startup? Basically Startup Schedules only fire if there is a 60 second wait between the Stop/Start.

I’ve had internal people ask me this question. We’ve even written it up as a something to do in our work tracking software. This has always been a low priority since it kind of makes sense to work that way. I’ve never gotten time to investigate it.

My guess is that it comes from the code we added to allow multiple Task Agent Services to run. You don’t want Service B picking up the tasks that Service A is already processing. That’s a total guess though.

If you ever see it do this but the time delay is 2+ minutes, then I would raise the priority of the investigation.

1 Like

@JeffLeBert I wasn’t much upset over the 1 minute, now that I know :slight_smile: figured out I communicate my observation for those that have “fast servers” :slight_smile:

Here is what happened:

  1. Restart TA
  2. Why isn’t Multi-Company Starting Up Again?
  3. Repeat 1-2, 5 times.
  4. Stop TA (not a restart, but a stop)
  5. Start TA
  6. Why isn’t Multi-Company Starting Up Still?!
  7. Blank out the Next Run Date
  8. Refresh System Agent Entry, Epicor put in a Next Run again.
  9. Enable/Disable Schedule, Still Nothing… Rebuild entire Multi-Company Schedule and spend 30min troubleshooting and checking my data
  10. Stop TA
  11. Blank out Next Run Date
  12. Start TA - ok it started Multi-Company a StartUp task this time!
  13. Stop TA
  14. Start TA
  15. Repeat 13-14 a few times.
  16. Stop TA
  17. Wait about 1-2min
  18. Start TA - It Started fine and Epicor blanked out the NextRun for StartUp yay again!

I was looking in the docs to find a “please wait 60 seconds after you stop TA, before you start it again” :slight_smile: I can replicate it everytime. Stopping takes 15 seconds, Starting takes 15 seconds, hence the problem… it works too fast for its own good :stuck_out_tongue:

It may be something as simple as an if/else in ScheduledTaskRunner.cs

I doubt its in this method, since this one seems to be only called when Schedule type is “Immed”


Hope the information helps anyone and your team :slight_smile:

Current Working Options:

  1. Stop TA, Blank Out NextRun, Disable/Enable Schedule, Start TA
  2. Stop TA, Wait 1-2min, Start TA
1 Like

I’ve added this information to the existing Jira story for this issue. I have no idea when we will get back to working in this area.

1 Like

@hkeric.wci I’m glad you did all the hard work for me :slight_smile: I moved my CDC stuff for Collab to ‘startup’ and it’s been aggravating me ever since, Glad I found this - Thank you!

So I wrote these two and have them scheduled for one a week using Windows Task Scheduler - note the 90 second delay.

DOS CMD (Powershell is below)

REM Stop Task Agent
@echo off
cd C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0

REM echo Stopping Task Agents
TaskAgentServiceConfiguration.exe -action="stopagent" -agentname="MyTaskAgent"
TaskAgentServiceConfiguration.exe -action="stopagent" -agentname="MyTestTaskAgent"

REM Echo Pausing...
timeout /t 10 /nobreak

REM Echo Stopping Service
net stop EpicorICETaskAgent4.1.100.0

REM Echo Pausing...
timeout /t 10 /nobreak

REM Echo Starting Service
net start EpicorICETaskAgent4.1.100.0

REM Echo Pausing...
timeout /t 90 /nobreak

REM Echo Starting Agents
TaskAgentServiceConfiguration.exe -action="startagent" -agentname="MyTaskAgent"
TaskAgentServiceConfiguration.exe -action="startagent" -agentname="MyTestTaskAgent"

cd C:\Users\<administrator>\Desktop

Powershell

#Set-ExecutionPolicy -ExecutionPolicy Unrestricted

#### Attempt to Stop AshworthTestTaskAgent
Start-Process -FilePath "C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0\TaskAgentServiceConfiguration.exe" -ArgumentList "-action=`"stopagent`"","-agentname=`"MyTestTaskAgent`"" -RedirectStandardError "c:\EpicortestData\TaskAgentRestart_err.txt" -RedirectStandardOutput "c:\EpicortestData\TaskAgentRestart.txt" 

#### Attempt to Stop AshworthTestTaskAgent
Start-Process -FilePath "C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0\TaskAgentServiceConfiguration.exe" -ArgumentList "-action=`"stopagent`"","-agentname=`"MyTaskAgent`"" -RedirectStandardOutput "c:\EpicorData\TaskAgentRestart.txt" -RedirectStandardError "c:\EpicorData\TaskAgentRestart_err.txt"

#### Attempt to Recycle the Agent Service
Stop-Service EpicorICETaskAgent4.1.100.0
Start-Sleep -s 10
Start-Service EpicorICETaskAgent4.1.100.0
Start-Sleep -s 90

#### Attempt to Start AshworthTestTaskAgent
Start-Process -FilePath "C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0\TaskAgentServiceConfiguration.exe" -ArgumentList "-action=`"startagent`"","-agentname=`"MyTaskAgent`"" -RedirectStandardOutput "c:\EpicortestData\TaskAgentRestart.txt" -RedirectStandardError "c:\EpicortestData\TaskAgentRestart_err.txt"

#### Attempt to Start AshworthTaskAgent
Start-Process -FilePath "C:\Program Files (x86)\Epicor Software\Epicor Task Agent Service 4.1.100.0\TaskAgentServiceConfiguration.exe" -ArgumentList "-action=`"startagent`"","-agentname=`"MyTaskAgent`"" -RedirectStandardOutput "c:\EpicorData\TaskAgentRestart.txt" -RedirectStandardError "c:\EpicorData\TaskAgentRestart_err.txt"
3 Likes

Powershell came in handy! Thank you maestro.

1 Like