Scheduled tasks and request timeout

Discussions with clients revealed that there is a general misunderstanding about the timeout setting in the definitions of scheduled tasks.


In Railo, the timeout setting you define with the scheduled task, does not set the requesttimeout of the called scheduled task. Just imagine the scheduled task calls a .jsp or .php site. Then you have no way of defining a requesttimeout (which is the maximum time a request will executed before it will be aborted), since php has no way of setting the requestimeout i.e. over a HTTP variable.
Now, here's the couriosity: In CFMX this still sets the requesttimeout for the called URL, if the called URL is a .cfm page executed by CFMX 7.0+.
How does that work? CFMX 6.0 has deprecated and turned off the usage of the standard url parameter requesttimeout=timeinseconds. So you had to set the timeout in the scheduled task itself. Which makes perfectly sense to me.
In version CFMX 7.0 without notifying the users it has been reintroduced. The documentation still mentions that it does not work. But if you check the access log, you will see that the scheduled tasks called by CFMX contain the url parameter requesttimeout=timeinseconds. This means that this url parameter overrules, or sets the requesttimeout of the called template.
Since this is a functionality that is not standard behaviour, or better said, the functionality is not clear, we have made it configurable in the Railo administrator. See image below:

If you check this checkbox, you will be able to add the requesttimeout standard url parameter to any of your requests. Railo sets the requesttimeout for the called request according to the value of the url parameter. In addition, when the checkbox is marked, Railo adds the requesttimeout url parameter to the called scheduled tasks urls. But of course on the other end (the end of the called request), the application server must support this parameter.

However, we do not recommend using this option, since it states a security risk. Just assume someone sets your requesttimeout for the call of a template to an unlimited time and your application runs into an endless loop inside this request.
The better option is to use the timeout setting in the scheduled tasks definition only for its intended functionality, which is to set the timespan Railo should wait for the execution of the called scheduled task. You should use the tag <cfsetting requesttimeout=numberofseconds> within your template in order to set the requesttimeout of the particular scheduled tasks.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner