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

  • Manage Remote Teams and Productivity During COVID-19

    With more than  471,862 cases around the globe, the coronavirus (COVID-19) pandemic has a devastating impact not only on the lives of hundreds of thousands of people but also on the global economy. The government aiming to contain and mitigate the disease has initiated the largest Coronavirus lockdown in the country. This has affected the […]

  • Hybrid Mobile Application Development: When, Why, and How

    When it comes to Hybrid mobile application development there is no one-size-fits-all solution. Every solution comes with its own set of pros and cons.  React native Vs Flutter Vs Native app Native and cross-platform approaches using React Native or Flutter have emerged to be popular mobile app development solutions. While native app development has carved […]

  • How To Hire React Native Developers? Highlighting Key Skills

    From being Facebook’s internal Hackathon project to one of the most trending frameworks for cross-platform app development-React Native has made it big! Numerous giants like Instagram, Airbnb, Walmart have developed their apps using React Native technology. Planning to adopt React Native for your next app development project ? Do you want to hire React Native […]

Leave a Reply

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