Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Baffled! Scheduled Tasks Runs Twice in Parallel Every Time!!

Explorer ,
May 21, 2008 May 21, 2008
I have a scheduled task that sends out a bunch of newsletters every day. It has been running smoothly for more than a year when it suddenly started to run twice - sending out the emails twice and updating the count twice. There have ben no changes to the source code, hardware, operating system, etc. The only change is that upgraded from MX7 to CF8.

Each time it sends a newsletter out it adds a record to a log table that is incremented automatically. From the sequencing of these records I know that it is actually running the stored procedured twice in parrallel in as much as the record ids on the duplicate records are always from 1 to 9 records apart whereas the set is more than 175 records long (the sequence gap should be at 175 records apart if it was run sequentially.

Also, the CF scheduler log only records the task as having run once. Other scheduled tasks also run twice.

The server is a Dell 1950 Dual Zeon server. CF8 is ver. 8,0,1,195765 Standard running on Windows 2003 Standard server. I am baffled as I see nothing in the code that would do this and since it worked just fine in MX7.

Any ideas anyone?????


6.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 21, 2008 May 21, 2008
Hmmm, could it be possible that CF 7 and 8 are both running?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 21, 2008 May 21, 2008
Brilliant!!!! I assumed that MX7 would stop running when I installed CF8. It did not! Can I safely uninstall it?

THANKS A MILLION!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 21, 2008 May 21, 2008
KDN0211 wrote:
> Brilliant!!!! I assumed that MX7 would stop running when I installed CF8.

Why? Many people like to run code through upgrades in parallel before
they remove the old version just to make sure nothing has gone horribly
wrong.


It did not! Can I safely uninstall it?
With a bit of caution. Backup your CF8 CFIDE folder first. Sometimes,
depending on the upgrade path, it is known to go missing when CF7 is
un-installed. It is easy to restore, if there is a copy to restore it
from. Otherwise it will cause quite a bit of heartache.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 21, 2008 May 21, 2008
Good point. It reminds me of the cautions about ASSUME. Thanks for the hints on un-installation. In the meantime I have disabled MX7. Thanks again. You are a life-saver.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 25, 2011 Aug 25, 2011

I have that same issue.  I do not have CF8 running at the same time but I did upgrade from CF8.  Is there some way to manually remove all registry entries and remaining artifacts from CF8 in case that is doing it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 25, 2011 Aug 25, 2011

Thishas been a thorn in my side for a while, and it is extremely difficult to trace or debug.  I know for sure that I only have one instance of CF9 running, and I look at the log files and only see information for one copy of a task being started and stopped, but I look at the results of the task (database info, etc) and sometimes see multiple (2x or 3x) set of data all inserted at exactly the same time.  Only happens on some tasks, not all.  Doesn't happen all the time or every time.  Only happens on the server that is still running CF8.  The CF9 machines (as far as I know!) are not showing this problem.  If anyone has any ideas for tracking down the problem beyond what I talked about above, that would be great.  I have even sat at my PC glued to perfmon showing CF activity while someone else kept firing off the scheduled task that usually shows the problem, and he would see it do the 2x or 3x executions, and I would never see the number of active CF tasks go up by more than 1.  Reboots of CF and/or the server do not have any effect.  Windows task manager only shows one copy of CF server running.  If Windows or Java is running more than once copy of the CRON process/thread I don't know how to determine that. problem will become academic at some point because I'm working on getting the CF9 licenses to upgrade the remaining CF8 servers. Sorry for the stream-of-consiousness post, will work on my prose skills next time.

thanks in advance,

-reed

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 25, 2011 Aug 25, 2011

I meant to say that I only have one instance of CF8 running (not CF9)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 25, 2011 Aug 25, 2011

This does not address the real problem of whatever is spawning your task twice but it will prevent the side effects:

<cfset variables.doAbort=false />

<cflock timeout="15" throwontimeout="yes" type="exclusive" scope="application">
  <cfif isDefined("application.autoRun")>
    <cfset variables.doAbort=application.autoRun GT now() />
  </cfif>
  <cfif not variables.doAbort>
    <cfset application.autoRun=dateAdd("n",10,now()) />
  </cfif>
</cflock>
<cfif variables.doAbort>
  <cfabort showerror="Process aborted due to 10 minute auto close moratorium. (authRun=#application.autoRun#)" />
</cfif>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 25, 2011 Aug 25, 2011

Thanks Steve.  where would this go, in each of my scheduled

cfms or in an application .cfm/cfc somewhere?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 25, 2011 Aug 25, 2011

I put it in the begining of the template being executed in the scheduler. But anywhere prior to execution of the "real work" that the scheduled task to doing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 25, 2011 Aug 25, 2011

Also, in my code the variable name is dynamic based on the task that is running. Instead of application.autoRun, I set variables.taskName="something" and then adjust all the application.autoRun statements: application[variables.taskName] or isDefined("application.#variables.taskName#")...

With a little thought, this can be tweaked to be a taskName URL parameter:

<cfif isDefined("URL.taskName:)>

     <!-- code from above tweaked to used URL.taskName --->

</cfif>

Then this could be put in your application.cfc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2011 Aug 26, 2011

Steve,

Thanks a million!  This was the solution to get me working at least as I still have not heard from Adobe since I gave them my credit card for a new incident.  Our helpdesk people would not be allowed to take that long to contact a user.

My problem was that in the course of doing file operations the hidden task was trying to access the file while the configured task had it and errors, file deletions and utter mayhem ensued.  I just set your value of 10 minutes to 5 minutes which fit in my scheduled task window and all of that stopped cold.

I appreciate all of the assistance with this.

Mike Besemer

MiTek Industries Inc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 26, 2011 Aug 26, 2011

Very cool. I sometimes get lucky with my advice.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 20, 2011 Sep 20, 2011

Mike - Did you ever get resolution on this issue? We just started seeing this same problem as of September 14 and we are definitely not running multiple instances nor are there multiple CF services running on the same machine. The server had run for months without this behavior, and then it suddenly started last week. Any information you can share on the resolution of the problem would be appreciated.

brian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 25, 2011 Aug 25, 2011

I am running CF9 and I have the issue as well.  I have a helpdesk ticket open with Adobe on this and are wating for the call.  They said they would call in approx one hour and that was about 2.5 hours ago.  I guess that is why they make you pay first.  I will post the answer if there is one.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2017 Oct 13, 2017
LATEST

In my case the scheduled task run twice within some milliseconds (sometimes the exact millisecond!)

Then I logged IP number and the duplet tasks was run from another IP.

Turned out our internet service provider had some redundat server set up that had kicked in, and somehow the "redundant" CF instance continued to run, even after our primary server kicked in again.

I put this code in some of my scheduled task, that really helped me!

<cflog file="myTasks" text="#GetCurrentTemplatePath()# Tickcount:#GetTickCount()# userAgent:#cgi.HTTP_USER_AGENT# IP:#cgi.REMOTE_ADDR#">

Then you go to CF Admin and find your myTasks.log at "Log files". Check that IP

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources