Avoid Zero (or super short) Application Timeouts

So here's a doozy for you. Over the past week or so I exchanged emails with a reader who was having an odd issue with ColdFusion mappings. Specifically the code he wrote to actually use the mappings would fail to work if he used application specific mappings. Switching to mappings defined on the server fixed it.

After I failed to notice it (and you can guess what's coming up based on the title of the entry), user BKBK on the Adobe forums pointed out that he had a 0-length application timeout: this.applicationTimeout = createTimeSpan(0,0,0,0);. Basically the application, and its settings, including the application mappings, timed out before his code could use it.

Why did he have it in the first place? He wanted a simple way to reload the Application on every request. For that I'd simply use a hook in your onRequestStart to run onApplicationStart():

function onRequestStart(string req) {

To be clear, this is not really reloading the application. It is just manually running your onApplicationStart method which is - 99% of the time - probably want you want. (During testing anyway, not in production.) You can also wrap that with a simple if(structKeyExists(url, "init")) block as well.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com