ColdFusion 9/10 generating hidden exceptions when using Images stored in RAM disk

Posted by Dan on Jan 8, 2014 @ 11:50 AM

We recently discovered an issue in ColdFusion 9+ when images that were temporarily stored in the RAM disk, but later removed would start throwing exceptions in the application.log, exception.log and coldfusion-out.log. The code itself would run just fine, so the issue is a bit masked because you won't see it unless you're monitoring your log files.

What we were seeing was a lot of errors like the following being thrown throughout our logs:

Could not read from ""ram:///797C39D0-CAE4-21F9-D573CFDC3FE7482E.jpg"" because it is a not a file.

When we tracked down why the log entries were being written, we discovered that the following workflow was causing the problem:

  1. Called a UDF to return a reference to a ColdFusion image object. The UDF would:
    • Use the RAM disk to convert the image into a common image format
    • It would then remove the temp file from the RAM disk
    • It would scale the image
    • Finally, it returned a reference to the ColdFusion image
  2. We would then attempt to write the image object to disk

It was when trying to write the image to disk, we'd start to see 3 exceptions being logged, but the code would generate the expected output. What appears to be happening, is that internally ColdFusion is trying to access the original "source" of the file for some reason.

What we did to fix the issue, was to return a new copy of the image using imageNew(imageGetBufferedImage(source)). What this does is create a copy of the image that no longer references any file on disk, but creates an image purely in RAM.

I'm sure this isn't a very common problem, but if you found that you're using Dave Ferguson's ColdFusion 9 PNG image processing fix you may find yourself running into this issue.

I've filed a Bug #3690487 with Adobe. This problem does affect ColdFusion 9 and 10, so if you think Adobe should fix it, make sure to vote it up!

Categories: HTML/ColdFusion

Comments for this entry have been disabled.