Skip to main content
WolfShade
Legend
Feb 14, 2019 8:12 PM UTC
Question

Variable undefined after latest patch for CF11

Hello, all,

We recently applied the most recent patch for CF11, and now we are being flooded with alert emails that a variable named "qRead" is undefined.

This is happening in a CFC function that gets distinct years from a database for news articles.

     <cffunction name=icleYears" output="false" access="public" returntype="Query" >
     <cfset qRead = "" />
          <cfquery name="qRead" datasource="news_2016" cachedwithin="#CreateTimeSpan(0,0,10,0)#">
               SELECT
                    DISTINCT TO_CHAR(TDATE,'YYYY') articleYears
               FROM
                    pa_news
               ORDER BY articleYears DESC
          </cfquery>
          <cfreturn qRead>
     </cffunction>

Whenever this function is accessed, a vague error message appears to the user, and an email is generated basically stating that "qRead is undefined".

We just rolled back the patch, and everything works fine.  Has anyone else experienced something like this?

V/r,

^ _ ^

    This topic is closed to new replies. Start a new post to keep the conversation going.

    33 replies

    Known Participant
    Mar 21, 2019 3:21 PM UTC

    Howdy!

    After installing the hotfix for CF-4204066, the missing variable problems related to cfquery and cachedWithin seem to be gone. I am no longer seeing those error messages and the queries appear to be functioning as they should.

    Before installing the hotfix I reverted my development system to the way it was just after CF11 u18 (in other words I undid all of the fun little tweaks I had done to make things work). This meant my other problems returned (neither cfhtmltopdf nor cffeed would run without errors), but, as mentioned, caching queries in a sandboxed environment seems to once again be working for me.

    Translate
    Known Participant
    Mar 20, 2019 3:39 PM UTC

    I just requested a copy of the fix from Adobe. Will post back how it works out.

    Translate
    Charlie Arehart
    Community Expert
    Community Expert
    Mar 20, 2019 3:35 PM UTC

    Wolf or others, can you confirm if the fix shared by Adobe, as discussed in this comment elsewhere, helps:

    Re: Cache, ColdFusion (11,0,18,314030)

    Translate
    /Charlie (troubleshooter, carehart. org)
    WolfShade
    WolfShadeAuthor
    Legend
    Mar 20, 2019 3:54 PM UTC

    I haven't seen/heard about u19.  Is it out?

    V/r,

    ^ _ ^

    Translate
    Charlie Arehart
    Community Expert
    Community Expert
    Mar 20, 2019 4:39 PM UTC

    No, and if you're asking relative to my last comment, it's a hot fix to be used until it's rolled into an update--which from experience prior to Feb could be some months away.

    Translate
    /Charlie (troubleshooter, carehart. org)
    Known Participant
    Mar 6, 2019 8:16 PM UTC

    Just wanted to add an update. As a result of having to poke at a different problem, I decided to try something.

    I relocated the mysql-connector-java-5.1.46-bin.jar file from {cf.root}/cfusion/lib/ to {cf.root}/cfusion/wwwroot/WEB-INF/lib

    I added a ColdFusion sandbox entry (to the Files/Dirs area for the website's sandbox) allowing for the reading of the mysql-connector-java-5.1.46-bin.jar file.

    The undefined variable error message I was getting seems to have stopped. (and fingers crossed it is actually gone and ColdFusion isn't just messing with me)

    Personally I am beginning to wonder if somewhere between update 15 and 18 access to {cf.root}/cfusion/lib/ was modified causing ColdFusion sandbox issues as a result of permission failures. Because the first attempt at access fails, all subsequent calls also fail, but differently. But what do I know, I am a bear of little brain.

    Translate
    Known Participant
    Mar 5, 2019 9:36 PM UTC

    Howdy!

    Just wondering, have there been any updates on this? I appear to be having either the same or a rather similar issue.

    When running a query like:

    <cffunction name="myQuery" returntype="query" output="false" access="public">

       <cfset var myQueryResult = "">

       <cfquery name="myQueryResult" cachedwithin="#CreateTimeSpan(1, 0, 0, 0)#" cacheID="myQueryCache">

          [SQL here]

       </cfquery>

       <cfreturn myQueryResult>

    </cffunction>

    I get the following error message: Variable MYQUERYRESULT is undefined.

    However, If I remove cachedwithin from the query there are no errors and the function (and its query) seem work as they should. I am starting to suspect this is either a cachedwithin issue or a Sandbox issue. Hence my curiosity about any new info.

    Running ColdFusion 11 Enterprise. Update 18 was installed Mar-4-2019, prior to that it was update 15 (on Win Server 2012). Sandbox Security is enabled.

    No errors during install of update 18, at least according to the install log.

    Using Java Jdk 1.8.0_201.

    Database is MySQL 5.7.25, using mysql-connector-java-5.1.46-bin.jar Data source connection verifies with status of OK in ColdFusion Administrator.

    Translate
    WolfShade
    WolfShadeAuthor
    Legend
    Mar 5, 2019 9:42 PM UTC

    Hi, gigiw123,

    Nothing new.  In fact, if you check out my most recent thread here, we have applied u18 and are getting more of the same.

    CFDUMPing the VARIABLES scope shows only two items, CFERROR and ERROR, both of which parrot the message in the error email that the variable is undefined.

    V/r,

    ^ _ ^

    Translate
    Adobe Employee
    Feb 17, 2019 12:20 PM UTC

    Hi Wolfshade,

    Please share the complete exception stacktrace so that we can investigate it further.

    You can send it to nimsharm@adobe.com

    -Nimit

    Translate
    WolfShade
    WolfShadeAuthor
    Legend
    Feb 19, 2019 4:29 PM UTC

    I've been contacted directly by Vamseekrishna Nanneboina and Suchika Singh  about this issue.  I'll be sure to include you when I get the email ready that contains the pertinent information.  Not sure if I can get you the complete stack trace, but I'll get whatever I can to you all.

    V/r,

    ^ _ ^

    Translate
    Inspiring
    Feb 15, 2019 8:30 AM UTC

    Hi,

    I've been naming my queries local.qRead etc. for years. Never use a variable without scope.

    Translate
    BKBK
    Community Expert
    Community Expert
    Feb 14, 2019 9:07 PM UTC

    Odd.

    In any case, you would avoid some complications if you initialized with

    <cfset var qRead = "" />

    Or, perhaps even better, with

    <cfset var qRead = queryNew("") />

    given that the return type is query

    Translate
    WolfShade
    WolfShadeAuthor
    Legend
    Feb 14, 2019 10:17 PM UTC

    I've had issues in the past when using var outside of a function.  Apparently, CF doesn't like to use var outside of a function.

    But I'll suggest the queryNew("") and see if that fixes it.  Thanks.

    V/r,

    ^ _ ^

    Translate
    BKBK
    Community Expert
    Community Expert
    Feb 15, 2019 5:53 AM UTC

    WolfShade  wrote

    I've had issues in the past when using var outside of a function.  Apparently, CF doesn't like to use var outside of a function.

    I don't understand. We're in a function, aren't we?

    Without the var, qRead becomes effectively an instance variable of the component. It is then cached and, after 10 minutes, deleted from memory, and so on. All of this happening while the component's instance is still alive? These are some of the complications I was referring to.

    Translate
    Carl Von Stetten
    Legend
    Feb 14, 2019 9:07 PM UTC

    A bunch of people have reported issues with queryExecute() following the updates, but I haven't heard of <cfquery> issues yet.

    Translate