ColdFusion CFFTP Timeout Value Cannot Be Dynamic

Posted August 29, 2008 at 10:05 AM by Ben Nadel

Tags: ColdFusion

Yesterday, when I was messing around with my first ColdFusion 8 sFTP commands using CFFTP, I came across a strange timeout bug. Many tags in ColdFusion allows us to enter override Timeout values. These values are always entered as seconds:

Timeout="30"

To make the code more readable, I like to make the timeout value dynamic when it has to be large. So, rather than doing:

Timeout="300"

... I'll make it more obvious:

Timeout="#(60 * 5)#"

While this might seem silly, 60*5 actually gives the programmer much more information than the value 300. For starters, by seeing the value "60" first, it indicates that the Timeout value is in seconds (rather than milliseconds). Secondly, by seeing 60*5, no calculation is required to know that the Timeout is set to 5 minutes; no having to divide 300 by 60 to see how many minutes that works out to.

Clearly, it's a great way to define Timeout values, but that's not what we're here to discuss. When I started to code my CFFTP example, I employed the same Timeout style setting:

  • <!---
  • Open the connection, cache it using, "objConnection",
  • and give it a large timeout.
  • --->
  • <cfftp
  • action="open"
  • connection="objConnection"
  • timeout="#(60 * 5)#"
  • attributeCollection="#objFTPProperties#"
  • />
  •  
  • <!--- Close the connection. --->
  • <cfftp
  • action="close"
  • connection="objConnection"
  • />

Here, as in my explanation above, I am setting the Timeout dynamically to be 5 minutes. Unfortunately, when I run the code, ColdFusion throws the following error:

(class: cftest2ecfm2015631588, method: runPage signature: ()Ljava/lang/Object;) Expecting to find object/array on stack null. The error occurred on line -1. java.lang.VerifyError: (class: cftest2ecfm2015631588, method: runPage signature: ()Ljava/lang/Object;) Expecting to find object/array on stack.

Well, obviously, right :) Talk about a ColdFusion error that give you zero insight into what actually went wrong.

Anyway, when I took out the dynamic Timeout value and put in a static "300," the page worked fine. Clearly a bug (that I have reported).




Reader Comments

Aug 29, 2008 at 12:10 PM // reply »
8 Comments

What happens if you assign 60 * 5 to a variable, and then plug the variable into the attribute?


Aug 29, 2008 at 3:19 PM // reply »
132 Comments

That seems to be CF generating an inconsistent class file. Something in the compiler is doing something naughty.

You should report this to Adobe, Definitely a bug!


Aug 29, 2008 at 3:20 PM // reply »
132 Comments

I'm slow... I see that you have reported it. Woops. My bad.


Aug 29, 2008 at 3:26 PM // reply »
11,314 Comments

@Duncan,

I did not try to do it as a variable. I just resorted to putting in the full time rather than the calculation.

@Elliott,

Naughtiness reported :) Weird looking error, right?


Aug 30, 2008 at 12:46 AM // reply »
14 Comments

Interesting finding! I wonder if it's just the calculation it has to do for the timeout value or if it's any variable at all.


Jan 12, 2010 at 5:38 AM // reply »
7 Comments

A little late, but this worked for other tags that gave the dynamic error...

I haven't tried it the cfftp timeout yet, but I think #int(60 * 5)# should work just fine...


Jan 13, 2010 at 8:19 PM // reply »
11,314 Comments

@Michael,

If you test it, let us know if it works (I don't have any FTP stuff set up for testing at the moment).


Jan 14, 2010 at 10:13 AM // reply »
7 Comments

@Ben Nadel,

Yessss Works like a charm!

<cfftp action = "open"

username = "Foo"

connection = "connection1"

password = "nonono"

server = "ftp.somethi.ng"

stopOnError = "Yes" timeout="#int(60 * 5)#">


Jan 16, 2010 at 5:21 PM // reply »
11,314 Comments

@Michael,

Very odd! I wonder why that works. Good to know - thanks for running the test.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Jun 18, 2013 at 3:39 PM
Experimenting With The Amazon Simple Storage Service (S3) API Using ColdFusion
Hi Ben, THANKS! While not bleeding edge, it is new to me & I like learning new things every day! ... read »
Jun 18, 2013 at 12:30 PM
Disabling Auto-Correct And Auto-Capitalize Features On iPhone Inputs
Also spellcheck="false" should be mentioned as part of html5 specs ... read »
Jun 18, 2013 at 8:40 AM
Using Named Functions Within Self-Executing Function Blocks In Javascript
Hi Ben, you forgot to mention the most important thing for named self-executing functions - they can be referenced by name ONLY inside their execution context (which is parens in this case), it mean ... read »
dee
Jun 18, 2013 at 7:01 AM
My Safari Browser SQLite Database Hello World Example
hai ben, this program is really good i could understand the concept but i dint know how to save it and how to open it as you have done in the video can u give that details pls ... read »
Jun 18, 2013 at 6:04 AM
Clearing Inline CSS Properties With jQuery
Thanks a lot for for post! It helped me a lot... after being stuck since 24 hrs.. found solution from your post. Thanks again! ... read »
Jun 18, 2013 at 2:31 AM
SOTR 2013 - The Best Conference I Never Went To
I keep watching it, should keep me happily distracted until SotR14 ;) ... read »
Jun 17, 2013 at 9:45 PM
What If All User Interface (UI) Data Came In Reports?
@Jonah, As I was reading what you wrote, it occurred to me that maybe I do something similar to that in some of my client-side code. In an application I'm working on, there are a bunch of unrelated ... read »
Jun 17, 2013 at 9:36 PM
Object Thinking By David West
@Jonah, Please, don't feel bad at all. I appreciate all that you have contributed to the conversation. And, the more points of view I get, the more confident I am that I will some day, some how und ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools