|
Image expired error message using CFChart |
A bug came up in an application that uses the CFchart tag to create flash charts.
On the initial load the charts display just fine, but if you refresh the page, or go back to it later to view the data the images error. They display like this:
There seem to be two potential reasons for this. The first is that the cache for the chart in ColdFusion has expired. It seems that by default the per request cache is for 5 seconds only, so if your template takes longer than this to run then you may end out with expired content before you serve it up.
To fix this try this, excerpt from the CFchart blog:
1. Stop the CF server.
2. Open
2<server image="PNG" cache="Memory" minTimeout="5000" maxTimeout="30000"....
Change this to whatever values you want.(Values of minTimeout and maxTimeout are in milliseconds.)
Full article here: http://cfchart.blogspot.com/2005/06/image-expired-trouble.html
The second potential reason for this, and the more likely in this case is that the code is running on a clustered server. The error is cause where the CFchart tag generates a temporary file (swf, png, jpg) and serves that up to the user. When the user makes another request there is no guarantee that the request will hit the same server, so it will not find the temporary file, and throws the 'content expired' error message.
You could ensure that the content is served up correctly by tying the user to the server using session management, or more ideally set the temporary file to be written to a central server in a kind of CDN (Content Distributed Network) way.
I'm off to try both and see which one works!