I have a page that accesses in-memory files. We have 10 - 20k files stored in hundreds of directories (up to 2000). All directories and files are created programmatically. There are no permissions set or changed. All files use the default CF account, which we have had no issues with.
Every once in a while, we get an error. We test for the existence of a directory. If it exists, we get the contents of the directory and do something with the files. We are successfully able to read directories whether there is content or not.
<cfscript>
LOCAL.RamFileDir = "ram://CatSearchMenu/9160";
</cfscript>
<cfoutput>
<cfif directoryExists("#LOCAL.RamFileDir#") eq true>
#LOCAL.RamFileDir# exists<br>
<cfdirectory name="getRamFiles" directory="#LOCAL.RamFileDir#" action="list">
<cfdump var="#getRamFiles#">
<cfelse>
#LOCAL.RamFileDir# DOES NOT exist<br>
</cfif>
</cfoutput>
Here's the error I am getting...
An error occurred when performing a file operation listFiles on file /CatSearchMenuSubCats/9160.
The cause of this exception was: org.apache.commons.vfs2.FileSystemException: Could not list the contents of folder "ram:///CatSearchMenuSubCats/9160"..
The error occurred in E:/INETPUB/WWWROOT/AVCATALOGS/...: line 92
91 : <!--- GET THE FILES --->
92 : <cfdirectory name="getRamFiles"
93 : directory="#LOCAL.RamFileDir#"
94 : action="list">
The getFileInfo() function shows that there's nothing preventing me from accessing the directory.
The image below shows a slightly different path. The path is different for the sake of brevity.
EXTRA BOUNTY INFO ~ added 6/9/2014
This specific directory passes the directoryExists() test but when we use cfdirectory to list the contents, it chokes. How could it pass one test and then fail?
We cannot do any cfdirectory action on this directory, no create, delete, or list action will work. We can, however, access the files within the directory if we know the name of the file.
When we restart the ColdFusion services, the ram is wiped out. Automatically, the files are created as needed by another process. The files can be up and running and working fine for days on end. Then, suddenly, just ONE of the directories is not available. It's never the same directory. A few days later, ONE MORE directory becomes unavailable. Again, every other directory (of the two thousand) works perfectly. Again, all of the files within any directory is perfectly accessible. Once a directory becomes unavailable, it remains that way until we restart the ColdFusion services.
<cfscript>
// SET RAM FILE BASE
LOCAL.RamFileBase = "ram://includes";
</cfscript>
<!--- TEST THE BASE --->
<cfoutput>
<cfif directoryExists("#LOCAL.RamFileBase#") eq true>
<h1>#LOCAL.RamFileBase# BASE EXISTS</h1>
<!--- GET THE BASE --->
<cfdirectory name="getRamBase" directory="#LOCAL.RamFileBase#" action="list">
<!--- LOOP THROUGH THE BASE --->
<cfloop query="getRamBase">
<!--- TEST THE SUB DIRECTORY --->
<cfif directoryExists("#LOCAL.RamFileBase#/#getRamBase.Name#") eq true>
<h3>#LOCAL.RamFileBase#/#getRamBase.Name# SUB DIR EXISTS</h3>
<!--- GET THE SUB DIRECTORY --->
<cfdirectory name="getRamSubDir" directory="#LOCAL.RamFileBase#/#getRamBase.Name#" action="list">
<!--- LOOP THROUGH THE SUB DIRECTORY --->
<cfloop query="getRamSubDir">
<!--- TEST THE SUB SUB DIRECTORY ~ WHERE THE FILES ARE --->
<cfif directoryExists("#LOCAL.RamFileBase#/#getRamBase.Name#/#getRamSubDir.Name#") eq true>
<b>#LOCAL.RamFileBase#/#getRamBase.Name#/#getRamSubDir.Name#</b> SUB SUB DIR EXISTS<br>
<!--- GET THE FILES IN THE SUB SUB DIRECTORY --->
<!--- THIS IS WHERE THE PROBLEM IS --->
<cfdirectory name="getRamFiles"
directory="#LOCAL.RamFileBase#/#getRamBase.Name#/#getRamSubDir.Name#"
action="list"
sort="DateLastModified ASC">
<!--- LOOP THROUGH THE FILES --->
<cfloop query="getRamFiles">