Scheduled Task run on wrong server

Franz Pilgerstorfer asked on November 21, 2023 11:42

During our latest deployment we encountered a rather annoying bug/problem with scheduled tasks.

We have two kentico instance servers running, targeting same db, no web-farm. Server Prod1 and Server Prod2. There is a loadbalancer in front. In case one sever is not accessible, balancer will target other server.

Both servers got exact same deployment, which contained two scheduled tasks referring a custom dll (customerXYZ.dll).

I deployed all elements first, to Prod1 and after that to Prod2. As I did have an error in a dll, Prod1 was unavailable for a few mins.

After finishing deployment to both servers I noticed that I was able to run ScheduledTask from Prod1, but did not get any custom eventlog entries and no errors, too (system states: executed successfully).

When I did run ScheduledTask from Prod2 I did get custom eventlog entries and code executed (sending Mails etc).

No matter what I tried, I was not able to get scheduled task running on Prod1.

What we tried so far:

  • added a new task (same settings) on Prod1, started it on Prod1 - system states "task has been executed" - nothing happens
  • edited task and put down a server name to run explicitly on Prod1 - no change at all
  • re-deployed files
  • restarted both instances
  • cleared cache
  • completly disabled Prod2
  • looked up windows - Application log for any warnings/exceptions - nothing there on both servers

If you have any ideas what to do, to try please let me know.

Any help is appreciated!

Correct Answer

Juraj Ondrus answered on November 22, 2023 06:16

If you have multiple apps connecting to one DB - it is a web farm. I would recommend checking the web farm configuration first. Then, I would apply the latest hotfix if not using it already. And I would double check that the deployment really contains all the code files and DLLs. Just to be sure.
What is your exact setup? How many admin apps and front end apps you have in total? Is the scheduled task running within the admin or live site app?
Are you using any web.config keys for scheduler? Such as the URL settings? What if one web.config file is using some forgotten key?
How is the load balancer configured? What if it is directing the scheduler request to one web farm server only?

0 votesVote for this answer Unmark Correct answer

Recent Answers


Franz Pilgerstorfer answered on November 22, 2023 16:58

Thanks for your answer. I checked my steps over and over again. Finally I found that there was a missing dll on Prod1! After adding it, I was finally able to start scheduled task and it has been executed, too!

Just cause out of curiosity - Kentico stated task executed successfully even with the missing dll.

Is there any chance to see some kind of log entry/event that points into the correct direction?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 23, 2023 06:22

There are no settings for this, unless you will add some logging logic to your code.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.