Skip to main content
Participating Frequently
February 13, 2012
Question

Scheduled Tasks running several times within seconds - why?

  • February 13, 2012
  • 1 reply
  • 4218 views

Hi

We have a number of scheduled tasks set to run overnight.  After running once daily (as expected) for a couple of months, some of the tasks started running up to seven times daily, with the subsequent tasks usually running within 10 seconds of the previous one, often running within 1 second or within the second!

The server is CF 9.0.1 running on Win 2008 R2 (SP1) 64-bit.

Here is an example from the scheduler.log file:

"Information","jrpp-175","02/11/12","01:01:16","DELIUMCRON","Drop Temp Tables"

"Information","jrpp-174","02/11/12","01:01:16","DELIUMCRON","Drop Temp Tables"

"Information","jrpp-169","02/11/12","01:01:32","DELIUMCRON","Drop Temp Tables"

"Information","jrpp-175","02/11/12","01:01:47","DELIUMCRON","Drop Temp Tables"

"Information","jrpp-169","02/11/12","01:02:01","DELIUMCRON","Drop Temp Tables"

"Information","jrpp-175","02/11/12","01:02:15","DELIUMCRON","Drop Temp Tables"

"Information","jrpp-175","02/11/12","01:02:30","DELIUMCRON","Drop Temp Tables"

We created the tasks using cfschedule.  An example is:

<cfschedule action="UPDATE" task="#TaskName#" operation="HTTPRequest" url="#TaskURL#" startdate="#StartDate#" starttime="#StartTime#" interval="Daily" resolveurl="no">

The URLs that get run do not recreate any tasks.

We can't understand why they would be running multiple times.  Anyone have any ideas?

I am about to post another post here that may be related whereby a CF datasource stops being able to connect to the database and we get the error "Datasource [NameOfDatasource] could not be found".  I don't know if these are related but they seemed to have started happening around the same time.

I didn't know whether this should be classed as a 'Question' or not, so ticked it just in case.

Nathan

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
February 13, 2012

There may not be a mistake and ColdFusion might just have done what was asked of it. The trouble is likely with the dynamic variable, startTime. You have to investigate why 7 values of startTime were passed to the cfschedule tag on February 11, 2012.

N DruryAuthor
Participating Frequently
February 13, 2012

Thanks BKBK.  The scheduled tasks are set up once to run daily at a set time.  They are not set/created every day.  A task only appears once in the CF Administrator listing and it has the correct time. 

Here is the code for creating one of the tasks running multiple times.

<cfscript>

    TaskName            = "CronTempTables";

    TaskURL            = "#ListLast(REQUEST.HTTPS, "|")#://#REQUEST.Domain#/~cron/cron_drop_temp_tables.cfm";

    StartDate            = DateFormat(now(), "YYYY/MM/DD");

    StartTime            = "01:00";

    Interval            = "Daily";

</cfscript>

<cfschedule action="delete" task="#TaskName#">

<cfschedule action="UPDATE" task="#TaskName#" operation="HTTPRequest" url="#TaskURL#" startdate="#StartDate#" starttime="#StartTime#" interval="#Interval#" resolveurl="no">

So each task should only run once, but they are running multiple times.

BKBK
Community Expert
Community Expert
February 14, 2012

Threading issues between the 2 cfschedule tags perhaps? The schedule-delete tag seems to me to be redundant. What happens when you leave it out?