Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

cflocation fails in CF10 but fine in CF9

476 views
Skip to first unread message

Mark Picker

unread,
Nov 20, 2013, 2:08:18 AM11/20/13
to cfau...@googlegroups.com

Hi,

 

I did post this to stackoverflow a month or so ago (http://stackoverflow.com/questions/19416810/cflocation-no-longer-working-in-cf10) but didn’t end up with any follow up answers after working out the real source of the problem.  Hoping someone on here has some ideas.

 

I have a multi-step process that runs overnight. The process is made up of about 10 files that chain together using cflocation (only follows cflocation if no errors were detected).  This was working fine until I moved from CF9 to CF10.  Code works fine until it hits cflocation tag.  Has anyone seen an issue with cflocation not working in CF10 vs. CF9?

 

I’ve been able to reproduce this problem with 2 files:

 

index.cfm
 

<h1>Testing cflocation</h1>

 

<cfloop index="i" from="1" to="7000" ><!--- For me it stops working once the loop goes beyond 6808 rows --->

    row <cfoutput>#i#</cfoutput>: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789<br/>

</cfloop>

 

<p>Now loading resultpage via cflocation</p>

<cflocation url="resultpage.cfm" addtoken="false">

 
 
resultpage.cfm
 

<h1>Made it!</h1>

<p>Reload the <a href="index.cfm">first page</a></p>

 

In my testing I found that if I looped 6808 times it works but 6809 times fails. With 7000 records we are only talking about a 36 KB file….any clues why this is failing only in CF10?

 

Cheers

Mark

Zac Spitzer

unread,
Nov 20, 2013, 2:09:45 AM11/20/13
to CFAussie
are you all up to date with hotfixes?


--
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfaussie+u...@googlegroups.com.
To post to this group, send email to cfau...@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/groups/opt_out.



--
Zac Spitzer
+61 405 847 168

Dale Fraser

unread,
Nov 20, 2013, 2:10:12 AM11/20/13
to cfau...@googlegroups.com

Im assuming this is a scheduled task,

 

Your page is timing out and never gets to the cflocation

 

Try adding a cfsetting to increase the timeout.

 

Regards

Dale Fraser

--

Dale Fraser

unread,
Nov 20, 2013, 2:16:20 AM11/20/13
to cfau...@googlegroups.com

Hmm strange,

 

Id suggest the redirect isn’t being generated, here is a work around

 

<h1>Testing cflocation</h1>

 

<cfloop index="i" from="1" to="7000" ><!--- For me it stops working once the loop goes beyond 6808 rows --->

    row <cfoutput>#i#</cfoutput>: abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789<br/>

</cfloop>

 

<p>Now loading resultpage via cflocation</p>

<script language="javascript">

     window.location.href="/newpage";

</script>

 

Regards

Dale Fraser

 

From: cfau...@googlegroups.com [mailto:cfau...@googlegroups.com] On Behalf Of Mark Picker
Sent: Wednesday, 20 November 2013 6:08 PM
To: cfau...@googlegroups.com
Subject: [cfaussie] cflocation fails in CF10 but fine in CF9

 

Hi,

--

Dale Fraser

unread,
Nov 20, 2013, 2:26:44 AM11/20/13
to cfau...@googlegroups.com

Ok I worked it out

 

In CF Administrator

Maximum Output Buffer size 1024

 

After which a flush will occur which will stop cflocation working.

 

Increase it and it works.

 

I’m happy to post this to stackoverflow if it works for you.

 

Regards

Dale Fraser

Andrew Scott

unread,
Nov 20, 2013, 6:14:21 AM11/20/13
to cfau...@googlegroups.com
If it is a scheduled task, does it require all that output? Personally I would pass in a URL variable for debug purposes if you require the output for visual confirmation or an email being sent off. But for a normal scheduled event, all that output is running execution cycles for no reason.

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/

Mark Picker

unread,
Nov 20, 2013, 11:02:44 PM11/20/13
to cfau...@googlegroups.com
@Zac: all but the one that just came out this month.
 
@Andrew:  this is a legacy process which I'm trying to keep running for only a couple of months until the whole lot will be rewritten (upstream source systems are being replaced so the whole process will change).  Traditionally each step was run manually and was only automated a couple of months before we changed to CF10.  The scheduled task is storing all the output into a log file which is sent in an email after the process has finished.  Certainly could be rewritten to only display output when manually run but it's now a question of available time to change and test vs. making it work as is until it's replaced.  But I do know where your coming from, if doing this again from scratch I certainly would do it differently.
 
@Dale: Thank you! and damn it yet again.  One day I will remember that I have a crap memory.  As soon as I saw your reply I remembered reading about that option a month or so ago but at the time I was focused on other applications and problems in PHP.  I made a mental note to look at that when I was back in the office and then completely forgot about it.  I am a little confused why the 1024 KB limit isn't enough for the test case to work though.  The test case should be less than 1024KB but upping the limit certainly does let it run correctly.
 
I think I'll try up the limit but also look at limiting the amount of output to only what I really need.  Thank you everyone!
 
Cheers
Mark
 

Andrew Scott

unread,
Nov 20, 2013, 11:42:43 PM11/20/13
to cfau...@googlegroups.com
Mark, no problem. Wasn't sure if you had the time or not, and didn't know if there was a way to just write a quick conditional statement around it or not.



Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/



--

Zac Spitzer

unread,
Nov 20, 2013, 11:54:33 PM11/20/13
to CFAussie
have you filed a bug in the adobe bug base?

Dale Fraser

unread,
Nov 20, 2013, 11:58:19 PM11/20/13
to cfau...@googlegroups.com

Its not a bug, its doing what it is supposed to do based on that setting.

 

Regards

Dale Fraser

 

From: cfau...@googlegroups.com [mailto:cfau...@googlegroups.com] On Behalf Of Zac Spitzer


Sent: Thursday, 21 November 2013 3:55 PM
To: CFAussie

Zac Spitzer

unread,
Nov 21, 2013, 12:05:23 AM11/21/13
to CFAussie
but then it should throw an error? otherwise it's an ugly silent fail

Andrew Scott

unread,
Nov 21, 2013, 12:05:42 AM11/21/13
to cfau...@googlegroups.com
Dale, is this a new feature in ColdFusion 10? And what error does it throw if it exceeds this buffer?

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/



On Thu, Nov 21, 2013 at 3:58 PM, Dale Fraser <da...@fraser.id.au> wrote:

Dale Fraser

unread,
Nov 21, 2013, 12:07:40 AM11/21/13
to cfau...@googlegroups.com

There is no error, because a cfflush will cause the cflocation header to be reset thus it just never happens.

 

The setting is new in cf10, and while different, not a bug.

 

Regards

Dale Fraser

Andrew Scott

unread,
Nov 21, 2013, 12:11:02 AM11/21/13
to cfau...@googlegroups.com
Dale, I am not disputing that it is a bug or not. This is not something I have any knowledge on, and can't find the setting in ColdFusion 9. But I am hoping to learn more about this setting and what makes this change different to not being in ColdFusion 9.

Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/



Dale Fraser

unread,
Nov 21, 2013, 12:12:05 AM11/21/13
to cfau...@googlegroups.com

No,

 

It’s the same as this, no error, nothing happens. The flush kills the location

 

<cfflush />

<cflocation url="page2.cfm" addtoken="false">

Mark Picker

unread,
Nov 21, 2013, 12:18:39 AM11/21/13
to cfau...@googlegroups.com
I don't really have the time but I am a bit conflicted with patching over the issue vs. proper fix.  The change to the source systems has already been delayed once so it's very possible it will be delayed again and I'll need to keep doing it this way for sometime yet (a.k.a usual story anytime something is only a temp solution :)).  Looking at the code now with the view to make a more permanent fix.  I guess I've got 8 hours before I "need" to head off to the Xbox One launch at midnight :)

Mark Picker

unread,
Nov 21, 2013, 12:21:36 AM11/21/13
to cfau...@googlegroups.com
@Zac & @Dale: That was the same conclusion I came to.  Although as I'm not sure that the content in the test is more than 1024KB, maybe it is a bug?  Regardless of that, it certainly is a change in behaviour from CF9 and I don't recall seeing this mentioned in any documentation on changes/new features etc. for CF10.

Mark Picker

unread,
Nov 21, 2013, 12:28:04 AM11/21/13
to cfau...@googlegroups.com
Sorry for the disjointed reply.  I hadn't seen that the conversation had continued about bug vs. feature

Adam Cameron

unread,
Nov 21, 2013, 3:35:39 AM11/21/13
to cfau...@googlegroups.com
I don't know how this ever worked. One cannot have both content and a redirect in a response. <cflocation> sets the HTTP status header to do a  302 redirect, but for that to work, one must've have yet sent any content down to the browser. Because the first thing that gets sent in a response are the headers. Once the response has started being sent to the browser one cannot change the HTTP status code, so one cannot use <cflocation> to redirect.

The only difference perhaps is that CF9 didn't used to send any content down to the browser until the end of the request or a <cfflush> is encountered, but maybe CF10 starts spooling the response down to the browser as soon as it has [some amount] of content there?

Either way, the code is "wrong", and relies on a vagary of CF's behaviour to work, rather than it working by design.

-- 
Adam

Dale Fraser

unread,
Nov 21, 2013, 4:42:26 AM11/21/13
to cfau...@googlegroups.com

Previously the output never happened and the location did

 

Now due to the flush

 

The content is happening and not the location

 

You are correct its one or the other.

 

Regards

Dale Fraser

--

Rodrigo Munera

unread,
Feb 5, 2014, 12:08:36 PM2/5/14
to cfau...@googlegroups.com
I've had this same issue intermittently since I upgraded from CF9 to CF10 last year. Went through an extensive debugging process with my host and came up empty-handed. It still happens from time to time that our cflocations just don't seem to fire. 

Our situation uses cflocation in a URL friendly app. Basically, a user will navigate to a URL in our server like "www.example.com/promotion", the actual "/promotion" directory doesn't exist, but rather the app looks at a lookup table and sends the user to their destination via cflocation, in our case the destination would be something like "http://www.example.com/?page=promotion.home". The buffer would never get even close to 1024K to have the page flushed, since this function runs on its own.

We debugged it by replacing the cflocation with the output string and it would fire immediately.

This code worked perfectly in CF9
Reply all
Reply to author
Forward
0 new messages