cfflush Problem (and Solution) on CF8 with IIS
ColdfusionPosting for three reasons:
- Googlers can confirm their suspicion that others are having the same problem.
- Provide a solution that, while perhaps inelegant, works.
- Avoids all the "must be something other than Coldfusion's fault" posts that seem to have accreted around the topic.
The Problem
The problem exists in CF8 through Cumulative Hotfix 2.
So yes, others are having the same problem, including posters to Adobe and House of Fusion's forums. The issue appears to only happen on a combination of CF8 and IIS. I have personally verified this on CF8 with IIS6 and others have claimed the same problem on IIS7. This does not happen with Apache 2.2, which I have verified, and I have not tested it on other Apache versions.
Why the problem happens is unclear. Note, in the scenarios described it does not have to do with IIS compression (see the Dan G. Switzer's comment). Multiple people have posted that IIS has some sort of minimum buffer length before it will return content to the client (i.e. browser), albeit this does not manifest itself on CF7.
Is it a bug? I'm sure I don't know. Adobe has not acknowledged it as such. But if you are here, chances are you are having a problem. So read on for a solution that works.
A Solution
The solution is outputting enough data before a cfflush call that it will cause CF8/IIS to send to the client. The problem is evident in situations using JavaScript or Flash where an image or DOM object is updated during a long running process (think progress bar UI convention)1. With CF8 and IIS, depending on the amount of output before a call to cfflush, the client may update only sporadically or only show the final output when the page request finishes.
A way to do this is create a proxy custom tag (e.g. cf_flush) with the content as such:
The 73729 value is one from the Adobe forum discovered by a poster there as the minimum data length needed to send to the client.
Yes this could be more sophisticated, doing things such as testing on the Coldfusion version and Web Server, but making the assumption that if you made it this far you can figure that out for yourself if you need it.
1 Yes use you could use AJAX, instead of flushing, and avoid the problem altogether.




Loading....