Copy link to clipboard
Copied
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,
^ _ ^
Copy link to clipboard
Copied
A bunch of people have reported issues with queryExecute() following the updates, but I haven't heard of <cfquery> issues yet.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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,
^ _ ^
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
BKBK wrote
I don't understand. We're in a function, aren't we?
Now that you mention it, yes. I was thinking of outside of
<cfscript>
function myFunction(){
...
}
</cfscript>
Bardnet normally I scope all of my variables when reading them, but if I'm setting to the variables scope I don't use "variables.varName" because the variables scope is default. But I will also give your "local.qRead" suggestion a shot.
V/r,
^ _ ^
Copy link to clipboard
Copied
I finally got a chance to test, and it didn't work. Same error message. "Message Variable QREAD is undefined."
<cffunction name="getYears" output="false" access="public" returntype="Query" >
<cfset var qRead = queryNew("") /><!--- Clearly established "qRead" --->
<cfquery name="qRead" datasource="_news" cachedwithin="#CreateTimeSpan(0,0,10,0)#">
SELECT
DISTINCT TO_CHAR(TDATE,'YYYY') articleYears
FROM
news
ORDER BY articleYears DESC
</cfquery>
<cfreturn qRead><!--- This is the line indicated by error message as the problem. --->
</cffunction>
Not sure where to go with this, now.
Preran, do you know if Adobe is addressing this critical issue?
V/r,
^ _ ^
Copy link to clipboard
Copied
Hi Jack,
I am checking with the team. Will get back as soon as I hear from them.
Thanks,
Preran
Copy link to clipboard
Copied
Thanks, Preran.
I hope Adobe can fix this, soon. But, it's late on a Friday of a holiday weekend and I won't be back until Tuesday to find out.
Have a good weekend, all.
V/r,
^ _ ^
Copy link to clipboard
Copied
Just curious incase it makes a difference, what DB type are you using?
Copy link to clipboard
Copied
Oracle. But it's not the DB, because it works just fine when we roll the update back.
And working for USG DoD, that's not an option.
V/r,
^ _ ^
Copy link to clipboard
Copied
WolfShade wrote
I finally got a chance to test, and it didn't work. Same error message. "Message Variable QREAD is undefined."
<cffunction name="getYears" output="false" access="public" returntype="Query" > <cfset var qRead = queryNew("") /><!--- Clearly established "qRead" ---> <cfquery name="qRead" datasource="_news" cachedwithin="#CreateTimeSpan(0,0,10,0)#"> SELECT DISTINCT TO_CHAR(TDATE,'YYYY') articleYears FROM news ORDER BY articleYears DESC </cfquery> <cfreturn qRead><!--- This is the line indicated by error message as the problem. ---> </cffunction>
Not sure where to go with this, now.
Looks like a bug. Since we've got nothing to lose now, what about trying out a change of name - because of the caching - and pinning things down with some validation? Something like
<cfset var qReadX = queryNew("") />
<cfquery name="qReadX" datasource="_news" cachedwithin="#CreateTimeSpan(0,0,10,0)#" result="qRes">
SELECT
DISTINCT TO_CHAR(TDATE,'YYYY') articleYears
FROM
news
ORDER BY articleYears DESC
</cfquery>
<cfif not isNull(qReadX)>
<cfreturn qReadX>
<cfelse>
<cfdump var="#qRes#">
</cfif>
Copy link to clipboard
Copied
I have a meeting that is about to convene in a few minutes. I'm going to trigger another error and forward a redacted email to Adobe for them to review. Once I'm done with that, I'll give your suggestion a shot. Thank you.
V/r,
^ _ ^
Copy link to clipboard
Copied
Hi,
I've been naming my queries local.qRead etc. for years. Never use a variable without scope.
Copy link to clipboard
Copied
Hi Wolfshade,
Please share the complete exception stacktrace so that we can investigate it further.
You can send it to nimsharm@adobe.com
-Nimit
Copy link to clipboard
Copied
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,
^ _ ^
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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,
^ _ ^
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
I haven't seen/heard about u19. Is it out?
V/r,
^ _ ^
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Contact the Adobe team and they might give you the JAR file that fixes the issue. That is what someone else with a similar cache problem did.
Copy link to clipboard
Copied
Thank you for the heads-up, BKBK. I have reached out to that address and am awaiting further instruction.
V/r,
^ _ ^
Copy link to clipboard
Copied
Will and bk, did you guys kiss that I had shared this same link and fix info here yesterday? (Re: Variable undefined after latest patch for CF11)
Note how gigi here had confirmed it worked for them. Hope it proves to work for you, Wolf