Shaun Mccran

My digital playground

18
N
O
V
2009

Image expired error message using CFChart

A bug came up in an application that uses the CFchart tag to create flash charts.

view plain print about
1<cfchart format="flash">Values</cfchart>

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:

Expired content

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 \lib\webcharts3d.xml 3. You can increase the timeout for keeping the graphs in the cache by editing the minTimeout and maxTimeout attributes:

view plain print about
1<?xml version="1.0" encoding="UTF-8"?>
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!

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Kane Kardashian's Gravatar Fm channels are very beneficial and interesting in all circumstances and conditions. It is attained and performed for the future and all such aspirations. The soft nature of http://essayzwriting.com/ are very vital and central in all conditions and types of the success.
# Posted By Kane Kardashian | 30/12/2015 02:32
Back to top