question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jobs Firing Multiple Times

See original GitHub issue

Version: 2.6.0

Expected behavior

Jobs scheduled in global.asax should fire one time each at the time specified in their triggers

Actual behavior

Jobs fire multiple times, seemingly increasing each time I add a new job to my application.

Steps to reproduce

Application_Start()
{
...
var properties = new NameValueCollection { { "quartz.threadPool.threadCount", "1" } };
ISchedulerFactory schedFact = new StdSchedulerFactory(properties);
IScheduler sched = (IScheduler)schedFact.GetScheduler();
sched.Clear();
sched.Start();

IJobDetail dailyEmailJob = JobBuilder.Create<DailyEmails>().WithIdentity("DailyEmailJob").Build();
ITrigger dailyEmailTrigger = TriggerBuilder.Create().WithIdentity("DailyEmailTrigger").WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(12, 05)).ForJob(dailyEmailJob).Build();

IJobDetail scheduledMaintenanceJob = JobBuilder.Create<ScheduledMaintenance>().WithIdentity("ScheduledMaintenanceJob").Build();
ITrigger scheduledMaintenanceTrigger = TriggerBuilder.Create().WithIdentity("ScheduledMaintenanceTrigger").WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(1, 0)).ForJob(scheduledMaintenanceJob).Build();

IJobDetail resourceAnalysisJob = JobBuilder.Create<ResourceAnalysis>().WithIdentity("ResourceAnalysisJob").Build();
ITrigger resourceAnalysisTrigger = TriggerBuilder.Create().WithSchedule(SimpleScheduleBuilder.RepeatSecondlyForever(10)).Build();

sched.ScheduleJob(dailyEmailJob, dailyEmailTrigger);
sched.ScheduleJob(scheduledMaintenanceJob, scheduledMaintenanceTrigger);
sched.ScheduleJob(resourceAnalysisJob, resourceAnalysisTrigger);
}

My Job:

[DisallowConcurrentExecution]
    public class DailyEmails : IJob
    {
        public void Execute(IJobExecutionContext jobContext)
        {
            ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
            Log.Info("Call to Daily Email Execute. \r\n");

            string url = Helpers.Utilities.GetDomain() + "/Scheduler/DailyEmail/?hash=" + VRS_Scheduler.ScheduledHash;
            var client = new WebClient();
            var text = client.DownloadString(url);
        }
    }

My log file looks like so:

2018-05-15 11:55:00,001 INFO [QuartzScheduler_Worker-1] Transport.Web.UI.Infrastructure.Scheduled.DailyEmails - Call to Daily Email Execute.

2018-05-15 11:55:00,002 INFO [QuartzScheduler_Worker-1] Transport.Web.UI.Infrastructure.Scheduled.DailyEmails - Call to Daily Email Execute.

2018-05-15 11:55:00,088 INFO [QuartzScheduler_Worker-1] Transport.Web.UI.Infrastructure.Scheduled.DailyEmails - Call to Daily Email Execute.

As you can see, the Daily Email job runs 3 times…

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
onebalabancommented, Apr 27, 2023

Had a similar issue. A job has been starting 50 times in a row. The reason was an incorrect cron string - * 0/5 * * * ? *. Fixed with 0 0/5 * * * ?. Quartz v3.6.2

0reactions
lahmacommented, Jul 14, 2020

Closing as hard to reproduce. Advice is to run latest Quartz from 3.x series. I suspect this is a configuration problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What can you do if you've been fired multiple times? How ...
Up until the early 2000s, staying in the same job for decades used to be the norm. Job hopping was seen as a...
Read more >
4 Lessons I Learnt from Getting Fired 4 Times
“Could you come into my office,” your boss asks without a look. You heart pounds in your ears. Your mind races through everything...
Read more >
Tips for How To Recover After Losing Your Job
If you've lost your a job, there are several steps you can take to recover, get back in the job market and begin...
Read more >
Termination & Retaliation
While Washington is an at-will employment state, employers cannot fire or retaliate against an employee who exercises a protected right or files a...
Read more >
update: how much of a red flag is it if a job candidate was ...
Remember the letter-writer asked about a job candidate who had been fired twice previously? Here's the update. I wrote in about six months ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found