When a long running query times out the onError page will not include our generic error handler. cfinclude fails with error
6.0.3.1 & 6.1.0.243
|Servlet Container |Apache Tomcat/9.0.89|
|Java |11.0.23 (Eclipse Adoptium) 64bit|
|OS |Windows Server 2022 (10.0) 64bit|
|Architecture |64bit |
We have had some issues with our DB timing out on certain bad query plans recently and have noticed that our error handler is not running when this occurs. “java.nio.channels.ClosedByInterruptException”
To test the issue:
We have the following in our application.cfc:
Request timeout is set to 2 minutes.
<cffunction name="onError">
<cfargument name="Exception" required="true" />
<cfargument type="String" name="EventName" required="true"/>
<cfdump var="#VARIABLES.error#"/>
<cfset VARIABLES.error = ARGUMENTS.exception />
<cftry>
<cfinclude template="/_errortemplates/cf.exception.cfm">
<cfcatch><cfdump var="#cfcatch#" label="error loading cf.exception.cfm"/></cfcatch>
</cftry>
</cffunction>
Normally our “/_errortemplates/cf.exception.cfm” would contain additional error handling and a generic error message for the user. For this test we replace the contents of “/_errortemplates/cf.exception.cfm” with just <cfdump var="#VARIABLES.error#"/> <cfabort>
At this point you would expect to have 2 dump outputs with the same contents when any type of exception is thrown.
if you create a page with a query that times out in 3 minutes (mssql)
<cfquery datasource="xxxxx" name="res">
WAITFOR DELAY '00:03:00';
select getdate()
</cfquery>
<cfdump var=#res#/>
What you will see is 2 dumps: the first will be the Query timeout:
Request [/timeout.cfm (C:\Sites\www\breakdown-services-full\casting.breakdownexpress.com\timeout.cfm)] has run into a timeout (timeout: 120 seconds) and has been stopped. The thread started 180227ms ago.
The second is caught by the try in onError(): “java.nio.channels.ClosedByInterruptException” which is not what is expected.
We should be seeing the same cfdump `’ contained within the include.
It basically errors on the cfinclude in on error for query timeouts only.
I would expect the page to timeout after 2 minutes or if not possible because of JDBC then the onError would be called at 3 minutes (when the query finally times out) and handle the include properly