Skip to main content
Participating Frequently
May 7, 2022
Question

Schedule Task not working after 2021 Coldfusion Upgrade

  • May 7, 2022
  • 3 replies
  • 4025 views

Hi,

I have Coldfusion installed on linuxOS  (as a code) on AWS instance. Trying to upgrade Coldfusion from 2018 to 2021 with the same working setting/code.

After upgrade, Schedule tasks is not working. When tried to manually run a task with output file, it doesnt run at all, and no logs are captured on scheduled tasks.

Scheduler package has been reinstalled, still not working.

In http logs, could see entries - which means it is not permission issue.

And the URL used in the task is HTTP - so not key issues.

 

Any idea on this issue ?

 

    This topic has been closed for replies.

    3 replies

    New Participant
    September 9, 2023

    The suggestion that the user gave for finding out what processes are running is brilliant.

    <cfset arySchedTasks = createobject("java","coldfusion.server.ServiceFactory").getCronService().listall() />

    Using this, I found that when I moved the scheduled tasks from one server to another by copying the neo-cron.xml from one server to another many of the processes stopped processing. When I reviewed the processes using the scheduled task list, I noticed that the processes that WERE working didn't have encrypted passwords in the password field while the ones that DID NOT work had encrypted passwords that prevented the processes from running due to the fact that when the processes ran, it couldn't decrypt the passwords that were in the neo-cron.xml file (as they were from a different server and therefore the decryption didn't work). To solve this issue, I opened up the neo-cron.xml file and manually took out all of the passwords in the password section of each profile and then saved it and replaced the file with the passwords in it and then restarted the CF service. Once restarted, the processes started running again by themselves.

    I wanted to share this in case anyone else was having the same issue. If your tasks are kicking off after moving servers, check to make sure there aren't any passwords store in the neo-cron.xml file.

    It took my ages to figure this out, so hopefully this helps someone else.

    Charlie Arehart
    Adobe Expert
    September 10, 2023

    Boo, do beware of that approach of just copying neo-*.xml files from one cf instance to another, not only for that reason but ESPECIALLY if the cf versions differ at all (version or update) as the xml could differ between them, causing subtle bugs.

     

    One may wonder how then to transfer such admin settings between instances (other than manually retyping them in the cf admin). There are a few ways--and note that they ALL taken care of the decryption/encryption of passwords between the instances:

    • The old gui-based CAR (ColdFusion ARchive) export/import feature, found in the cf admin (which was Enterprise-only prior to cf11 but was opened for all for nearly 10 years now--but many still don't know)
    • The new CLI-based cfsetup tool added to cf2021, which allows export/import via JSON files. You can find more about by googling that word, including a substantial Adobe doc page as well as a webinar on it that I did. While the docs say not to use it with other than cf2021 or above, I show using it with as early as cf10 in the talk. It also backs up what it changes, which is nice.
    • There is also the Commandbox cfconfig tool, which predates cfsetup, as another means to export/import settings between instances vian json. It has more features and flexibility, and I discuss it in my talk linked to below. 
    • Of course, the first launch of the cf admin will offer to migrate in settings of a an earlier cf version found on the same machine. And that can be triggered to run again later, as I discuss in a blog post of also several years ago. 
    • Finally, if one feels they have no choice but to do a "manual" migration, typing settings from one instance into another, there's at least another way to "check your work". I have a talk on migrating (or comparing) cf admin settings , and in particular I discuss an approach to automate comparison of admin setting in the two instances. I show using the output of the cf admin "settings summary" screen with a good compare tool (like BeyondCompare), which some may find helpful. The talk also discusses the other tools and processes above

    I know this is all going off-track from Bill's issue here, but since you offered this approach of copying xml files (and he commented today he'd be checking if that may have happened), I thought I'd offer this for you both or other/future readers. 

    /Charlie (troubleshooter, carehart. org)
    Known Participant
    September 11, 2023

    Sometimes you may only have manual migration presented  as an option - in our case it's due to reliance on terraform code to build CF AWS instances where one step involves copying neo-*.xml. Without rewriting iac code it's hard to get around this. And that code is not necessarily accessible to all. Having said that, I have noted your talks around this subject and will be reading up: particulalry with regard to  "the xml could differ between them, causing subtle bugs." Thanks for raising awareness on that.

    BKBK
    Adobe Expert
    May 8, 2022

    As there is nothing in the logs, it implies the tasks are not running. It just might be that the tasks are not yet fully registered on CF2021.

     

    To verify, open the CF2021 Administrator and go to the page Server Settings > Scheduled Tasks. Are the tasks registered there? If so, do they have the settings you expect? Verify that each setting is valid.

     

    Do some simple tests. For example, what happens when you click on the button to run a task? Also, the edit button enables you to edit a task where necessary.

    Participating Frequently
    May 9, 2022

    The scheduled task are definetly present. I see them in the console. I had also created some test tasks, and tried it running, it never runs.

    BKBK
    Adobe Expert
    May 9, 2022

    Weird that ColdFusion fails to show any errors.

     

    You could try:

    1. Upgrading CF2021's Java to 11.0.15;
    2. Going to the ColdFusion Administrator Package Manager > Packages page, clicking on Available Packages, and ensuring that all packages are installed;
    3. Doing the following test
      (Place testScheduler.cfm and testTask.cfm in the web root (wwwroot). Then launch the URL of testScheduler.cfm in the browser.)
      <!--- testScheduler.cfm --->
      <cfschedule
       action="update"
       task="testTask"
       operation="HTTPRequest"
       startDate="#now()#"
       startTime="7:00 AM"
       url="http://localhost:8500/testTask.cfm"
       interval="60" />
      ​

      <!--- testTask.cfm --->
      <cfscript>
      testString="The time is now: " & dateFormat(now(),"full") & " " & timeFormat(now(), "HH:nn:ss");
      writedump(var=testString, format="html", output="#server.coldfusion.rootdir#/logs/scheduledTaskTestResult.html");	
      </cfscript>​
      As a result the file scheduledTaskTestResult.html should be created in the /cfusion/logs directory. Verify.

     

     

    Charlie Arehart
    Adobe Expert
    May 7, 2022

    While it's understandable that you feel the problem is with the scheduled task mechanism, you should at least try the url in a cfhttp running on the same cf instance. Then dump the resulting cfhttp variable. What does it show? And how long does it take?

     

    There can be various reasons why a call out of cf could vary between a cf2018 and a cf2021 instance, even from the same server. There could be jvm differences, beyond the differences in cf itself. 

     

    In fact, what jvm do you see cf running on in each cf version? It's on the cf admin settings summary page, for example. And what cf2021 update are you on (same page)?

     

    (Yet another sanity check would be to setup a new task going to a url that you know works from the browser on the server.) 

    /Charlie (troubleshooter, carehart. org)
    Participating Frequently
    May 9, 2022

    Hi Charles, I am delighted to see your response. Thank you!

    I havent tried the first step, however below is the jvm versions and the update version used.

    cf2021

    Server Product ColdFusion 2021
    Version 2021,0,03,329779
    Update Level /opt/coldfusion/cfusion/lib/updates/chf20210003.jar Java Version 11.0.11

    cf2018

    Server Product ColdFusion
    Version 2018,0,13,329786
    Update Level /opt/coldfusion/cfusion/lib/updates/hf201800-0022340.jar Java Version 11.0.11

     

    And i access the same url in the cf server, i am able to access it. It is just that the task doesnt run at all, if the url is not working i would see the same errors in the logs, isnt it. In my case, the url is working when access from the server, and i dont see any logs for error.

     

    I would check on your first step and update the status.

    Charlie Arehart
    Adobe Expert
    May 9, 2022

    Thanks for the update, Vino. And first, please call me Charlie. 🙂 Only my sister and a nephew still call me Charles. Long story.

     

    So besides my first suggestion of testing a cfhttp call to the task url (very important), note also my last one of testing a task calling something else, like simply google.com. Let us know how those go. 

    /Charlie (troubleshooter, carehart. org)