Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Bob G. / ()
Created: 07/09/2019
Components: Database, CFQuery, Scheduler
Versions: 2018,14.0
Failure Type: Non Functioning
Found In Build/Fixed In Build: 2018.0.04.314546 / CF2018U5
Priority/Frequency: Major / All users will encounter
Locale/System: English / Other
Vote Count: 4
Problem Description:
cfquery tag fails inside scheduled task with null message and null cause. This is happening for most but not all our scheduled tasks. Sometimes a restart causes a task to go from working to failing or failing to working. The particular SQL statement doesn't seem to matter - nor does it matter the datasource or whether the dbtype is query.
Steps to Reproduce:
Schedule a task using the below handler.cfc. Run the task from the CF Administrator. View test.log. Run test.cfm to invoke the task manually. View test.log.
handler.cfc
---------------
{code:java}
<cfcomponent implements="CFIDE.scheduler.ITaskEventHandler" output="false">
<cffunction name="onTaskStart" access="public" output="false" returnType="boolean">
<cfargument name="context" type="struct" />
<cfreturn true />
</cffunction>
<cffunction name="execute" access="public" output="false" returnType="void">
<cfargument name="context" type="struct" />
<cflog file="test" type="information" text="execute start" />
<cftry>
<cfset local.query = queryNew("id") />
<cfquery name="local.test" dbtype="query">
SELECT id
FROM query
</cfquery>
<cfcatch>
<cflog file="test" type="error" text="execute catch: #serializeJSON(cfcatch)#" />
</cfcatch>
</cftry>
<cflog file="test" type="information" text="execute finish" />
</cffunction>
<cffunction name="onTaskEnd" access="public" output="false" returnType="void">
<cfargument name="context" type="struct" />
<cflog file="test" type="error" text="onTaskEnd: #serializeJSON(context)#" />
</cffunction>
<cffunction name="onError" access="public" output="false" returnType="void">
<cfargument name="context" type="struct" />
<cflog file="test" type="error" text="onError: #serializeJSON(context)#" />
</cffunction>
<cffunction name="onMisfire" access="public" output="false" returnType="void">
<cfargument name="context" type="struct" />
<cflog file="test" type="error" text="onMisfire: #serializeJSON(context)#" />
</cffunction>
</cfcomponent>
{code}
test.cfm
----------
{code:java}
<cfset handler = new handler() />
<cfdump var="#handler#" />
<cfset handler.execute({}) />
{code}
Actual Result:
Running the task from the administrator fails at the query tag with the following error. Running it manually from test.cfm runs without throwing an exception.
{
"Cause": null,
"Message": null,
"LocalizedMessage": null,
"StackTrace": [
{
"ClassLoaderName": null,
"FileName": "NeoBodyContent.java",
"ModuleVersion": null,
"NativeMethod": false,
"ClassName": "coldfusion.runtime.NeoBodyContent",
"LineNumber": 351,
"MethodName": "getString",
"ModuleName": null
},
{
"ClassLoaderName": null,
"FileName": "QueryTag.java",
"ModuleVersion": null,
"NativeMethod": false,
"ClassName": "coldfusion.tagext.sql.QueryTag",
"LineNumber": 762,
"MethodName": "doAfterBody",
"ModuleName": null
},
{
"ClassLoaderName": null,
"FileName": "path\to\handler.cfc",
"ModuleVersion": null,
"NativeMethod": false,
"ClassName": "cfhandler2ecfc1069117455$funcEXECUTE",
"LineNumber": 16,
"MethodName": "runFunction",
"ModuleName": null
},
...
],
"Suppressed": []
}
Expected Result:
cfquery tag should behave the same everywhere regardless of whether it is run from a scheduled task
Any Workarounds:
None
Attachments:
Comments: