tracker issue : CF-4204716

select a category, or use search below
(searches all categories and all time range)
Title:

cfquery tag fails inside scheduled task with null message and null cause

| View in Tracker

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:

This seems like a critical issue
Vote by Brandy T.
31056 | July 22, 2019 06:18:13 PM GMT
I have tried this issue  in Version 2018,0,04,314546 and Version 2016,0,11,314546, I have schedule task using using  CF Administrator and i am not getting any exception. In test.log below content generated. {code:java} "Information","http-nio-8500-exec-1","07/23/19","14:24:23","","execute start""Information","http-nio-8500-exec-1","07/23/19","14:24:23","","execute finish""Information","http-nio-8500-exec-4","07/23/19","14:25:00","","execute start""Information","http-nio-8500-exec-4","07/23/19","14:25:00","","execute finish"{code} Can you please give me more information , how we can reproduce this issue. Also if you can provide any exception stack trace.  I have use same code which you have provided.
Comment by Yogesh P.
31058 | July 23, 2019 09:15:47 AM GMT
I provided a truncated stack trace in the issue description under Actual Results: Do you need additional information?
Comment by Bob G.
31062 | July 23, 2019 01:14:35 PM GMT
Can you please provide me your CF admin setting summary pdf. Step-: Server Settings-> setting summary page and save as pdf. Also it's good if you have attach any additional information which you can check in exception.log 
Comment by Yogesh P.
31071 | July 24, 2019 07:50:23 AM GMT