Skip to main content
Ben Nadel at cf.Objective() 2013 (Bloomington, MN) with: Job de Bruyne
Ben Nadel at cf.Objective() 2013 (Bloomington, MN) with: Job de Bruyne

ColdFusion CFFTP Timeout Value Cannot Be Dynamic

By
Published in Comments (9)

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).

Want to use code from this post? Check out the license.

Reader Comments

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!

15,848 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?

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.

8 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...

8 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)#">

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel