Close

Trouble with CFChart – Image expired

Thanks to the few users who acknowledged my last post on the topic of CFChart. I hope it has been (and will continue) useful to even more people. One particular developer, delta_mu, commented on a problem he was having when using the CFChart as explained in my post.

When a user reaches a page with cfcharts in flash format by clicking the browser ‘back’ button, instead of the original flash chart, an image that says “Image expired. Please refresh the page to view the image” is displayed.(Sample image shown below) Very clearly, not desirable.

The problem occurs for two reasons.

Lack of session management.
Short image caching duration.

When we use the cfchart tag to create a chart, coldfusion creates a temporary SWF or JPG or PNG image for display. If no session management is enabled, the cluster manager will send the user to a different server each time and hence there will not be any image to display. This can be prevented by enabling session management and the process is called session affinity.

However, in this user’s case, I doubt whether this was the case as he most probably uses a developer edition for such purposes and hence no clustering is involved as it is a single server setup. Thus it must be reason number two – The cache.

Once a request has been made, by default, the images will only kept for a duration of 5 seconds in the cache. Hence when the user hits the back button, the request no longer exists. This duration can be extended by following the few simple steps listed below, courtesy Prayank’s blog.

Stop the CFServer.
Open coldfusion x.x\lib\webcharts3d.xml
Find and change the values “minTimeOut” & “maxTimeOut”.
Restart the server.

Thats it. You are ready to go. But please remember that this solution is inefficient when you have a large number of charts to display.

Latest stories

  • How to build a scalable web application using Microservices Architecture

    Millions of people worldwide stream more than two billion hours worth of video from Netflix each month. Another example is Facebook, which roughly had 2.85 billion active users in the first quarter of 2021. Talking about the e-commerce giant, Amazon receives more than 66 thousand orders per hour, and 18.5 orders per second. Whoooo! So, […]

  • Flutter vs React Native: What to choose in 2021

    If Flutter vs React Native is your burgeoning question for this year 2021, guess what you are not alone. We no longer need statistics to know about the ever-growing popularity of mobile apps across the world. According to the latest report, global consumers are now spending an average of 4.2 hours per day using apps […]

  • React Native App development: Top Reasons to Choose It in 2021

    The promising cross-platform app development framework aka React Native has garnered huge popularity in recent times. The technology enables simultaneous mobile app development for multiple platforms using a single and a fraction of resources required for native development. The react native framework has emerged to be a popular choice among businesses to fulfill their cross-platform […]

Leave a Reply

Your email address will not be published. Required fields are marked *