Skip to main content
rener95577333
Participant
November 29, 2018
Answered

Cfthread not working (New upgrade to CF 2018 std)

  • November 29, 2018
  • 5 replies
  • 899 views

Hi,

I installed a new server (Win 2012 R2 / IIS) to migrate an old CF10 server to the new CF2018 version. Problem is cfthreads are not executing on CF2018.

For testing purposes I setup a simple page as follows:

======================================

INSERT INTO TABLE (record1)

<cfthread action="RUN" name="Test_Thread">

    INSERT INTO TABLE (record2)

</cfthread>

INSERT INTO TABLE (record3)

======================================

Records #1 & #3 get inserted, but not record #2.

Log shows:

application.log = "Error","cfthread-1","11/29/18","16:02:42","","TEST_THREAD: coldfusion/runtime/CFPage".

cf-out.log = Nov 29, 2018 16:02:42 PM Error [cfthread-1] - TEST_THREAD: coldfusion/runtime/CFPage

exception.log = Caused by: java.lang.ClassNotFoundException: coldfusion.runtime.CFPage

Couldn't find any info on this.

Any suggestion?

Thanks!

    This topic has been closed for replies.
    Correct answer rener95577333

    This have been puzzling me for the past few months trying to isolate the cause. I didn't want to reinstall because of we had so many configured DSN's, schedules, etc. I should have known better! Yesterday I gave up troubleshooting and decided to remove CF2018 and re-install. Problem Solved!!!!!

    Now cfthread works as expected on MySQL 5.7 and MySQL 8.0; when previously cfthread only worked on non-odbc calls. When I first installed, I never received an error/alert; so this will be an solved/unsolved mystery...

    Thanks to all for your suggestions!

    5 replies

    rener95577333
    rener95577333AuthorCorrect answer
    Participant
    February 6, 2019

    This have been puzzling me for the past few months trying to isolate the cause. I didn't want to reinstall because of we had so many configured DSN's, schedules, etc. I should have known better! Yesterday I gave up troubleshooting and decided to remove CF2018 and re-install. Problem Solved!!!!!

    Now cfthread works as expected on MySQL 5.7 and MySQL 8.0; when previously cfthread only worked on non-odbc calls. When I first installed, I never received an error/alert; so this will be an solved/unsolved mystery...

    Thanks to all for your suggestions!

    rener95577333
    Participant
    February 4, 2019

    Now it get weirder. I was able to make it work if I use a cfinclude inside the cfthread like this:

    thrpage.cfm

    =============================================

    <cfthread action="run" name="THR1">

        <cfinclude template="action.cfm">

    </cfthread>

    =============================================

    action.cfm

    =============================================

    <cfquery name="QR1" datasource="mydsn" dbtype="ODBC">

    INSERT INTO TBL1 (field1) VALUES ('ok')

    </cfquery>

    =============================================

    But that only works if I first call the stand alone page "action.cfm" before any subsequent calls to "thrpage.cfm". This will continue to work until I edit the "action.cfm" page. As soon as I edit that page the cfthread stops working. Any edit like adding a space or character to the end of the page will not allow subsequent chthreads on the "thrpage.cfm" until I re-execute the "action.cfm" on the browser.

    I suspect this could be a cache issue. But even restarting the server will not make it work. Only calling the "action.cfm" page first seams to solve the issue; unless that page is edited.

    BKBK
    Community Expert
    Community Expert
    February 4, 2019

    It think it is sufficient to run just thrpage.cfm alone. If you run action.cfm followed by thrpage.cfm you will be doing the insert twice.

    rener95577333
    Participant
    February 5, 2019

    Problem is that:

    1. I run "thrpage.cfm" (w/ cfinclude "action.cfm" inside cfthread) NO INSERT will happen.
    2. if I run "action.cfm" 1 INSERT will happen.
    3. If now I run "thrpage.cfm" 1 INSERT will happen for every time I reload/access the page.
    4. If I edit "action.cfm" and add a character or space to the file & save:
    5. Now I run "thrpage.cfm" NO INSERT will happen (ever) until I go to step #2.

    This happens on MySQL 8.0 & 5.7. I have tried to enable/disable cache features at no avil.

    As last resort, I'll try to uninstall and reinstall CF2018

    rener95577333
    Participant
    February 4, 2019

    More info about this issue... It's apparently an issue with MySQL 8 support. If I setup the same DSN w/ MySQL 5.7 instead of MySQL 8.0 the cfthread works as expected.

    I can connect and execute DB Commands (like Inserts/updates) on MySQL 8 using the mysql-connector-java-8.0.12.jar. This works flawlessly on any .CFM page; even with a query inside a cfinclude. But as soon as I place the cfquery inside a cfthread tag nothing happens I get the log error on the OP.

    The same example as above but using a DSN on MySQL 5.7 works without issues.

    Can anyone with CF2018 & MySQL8.0 confirm?

    Community Expert
    December 2, 2018

    If you're inserting into the same table within the CFTHREAD that you're inserting into before and after, I'm not surprised that you're having problems. Databases usually require some way to handle transactions so that they don't mess up other transactions. In some databases, this is handled by locking. So, the first query would place an exclusive lock on the table, the second query would run in a second thread (concurrently, not serially) and the third query would again require an exclusive lock on the same table. In a single program, this is usually not a problem because the queries would be handled serially. There are all kinds of potential complications here, as well: what is the transaction isolation level, etc, etc.

    Dave Watts, Fig Leaf Software

    Dave Watts, Eidolon LLC
    BKBK
    Community Expert
    Community Expert
    December 1, 2018

    Could you show us the code you used. I strongly suspect it needs to be corrected.

    I tested the following code on a database table named tbl (having 2 columns, of type date and UUID):

    <cfset sql1="INSERT INTO tbl VALUES(#now()#,'#createuuid()#')">

    <cfset queryExecute(sql1, {}, {datasource="myDSN"})>

    <cfthread action="RUN" name="Test_Thread">

       <cfset sql2="INSERT INTO tbl VALUES(#dateAdd('d',1,now())#,'#createuuid()#')">

       <cfset queryExecute(sql2, {}, {datasource="myDSN"})>

    </cfthread>

    <cfset sql3="INSERT INTO tbl VALUES(#dateAdd('d',2,now())#,'#createuuid()#')">

    <cfset queryExecute(sql3, {}, {datasource="myDSN"})>

    It works as expected. Nevertheless, sometimes the insert in the thread is done last. But, then again, that is what you would expect of asynchronous threads.