Disappearing RAM files

I’m creating files in the RAM drive on ApplicationStart. Is there any reason why they disappear and need recreating? There are not many files so it is not a space issue AFAIK.
From what I can see they should be available to all sessions.

What am I missing?

Thanks

Don’t forget to tell us about your stack!

OS: OSX
Java Version: ???
Tomcat Version: ???
Lucee Version: Latest

  • which version of Lucee? Please always state the version when asking for support
  • do they disappear after while or immediately?
  • are they big files or small files?
  • how much ram does lucee have available

I did put the latest version - Lucee 5.3.9.141.

They stay for a while and then seem to go - I’ve not timed it yet. I think it’s something I’m doing wrong but can’t fathom what. They are created in the application scope and I would have expected them to last for the time of the application - in this case 2 days. They seem to disappear quite fast. The ram available is the default set up using the express install. I doubt there is more than 200K of files.

Would they be linked to the session time?

Thanks

off the top of my head, unless the application has expired, it’s probably possibly due to memory pressure and the ram drive (i think is using soft references), so if needed, the JVM may GC items in the ram drive if it runs out of memory. [LDEV-1109] - Lucee

you could try adding cflogs to onApplicationStart/onApplicationEnd to see if the application expires or restarts?

Can’t see any memory pressure - The graphs in the admin are not above 20%. The files time out after about 20 minutes and there is no restart with the application.

  1. Rerun onApplicationStart - files appear
  2. Wait 20 mins with server under no load - files disappear
  3. Run restart app using url.restartApp - files appear

Setting for ram in Application.cfc = this.mappings["/ram"] = “ram://”;

I wasn’t successful with writeLog() - I could get my own message but not any system generated information - could you give me an example please.

Do you know the memory allocated as default in Express?

Thanks for your time!

I’ve been wracking my brain but I can’t remember. I’m sure I’ve read a post here or in the CFML slack saying something like the RAM drive was volatile or something like that and files could just be ejected.

Recently had an issue with files in the RAM drive (which I’m sure, whilst researching found said post) and ended up just moving it to a /tmp and cleaning up after.

I think this was the reference… RAM drive not available again in lucee(RAM error) - #28 by micstriit

just change the log level for application to INFO in the admin, or use the argument type="error", the default log level is ERROR, or use SystemOutput() :: Lucee Documentation which logs to the console

to change the config for express, set ENV vars as per

https://docs.bmc.com/docs/ars91/en/increasing-the-jvm-memory-allocation-and-thread-stack-size-609073221.html#JVMMemory-73425108

It’s not the application restarting - I think it is the ENV vars. I changed them to max 2GB and the files have remained now for over two hours… I’ll update this if everything is still OK tomorrow, which should be enough time to test it!

Thanks

1 Like

No restart needed - the files are still there - I think this has cured the problem! This is the kind of information that deserves to be in the lucee docs for the RAM Drive. It’s crazy that something so easy to sort is buried in the minds of devs and not available where it is needed.

Thanks Guys, for your help on this!

Good suggestion, I added a note to the docs

Thanks Zac!

Feel free to update any of the docs you want to, there’s a github icon on each page which lets you edit them and file a PR

Humm - The RAM increase worked for about 1 1/2 days and then was GC’d. Files gone again. Do we have any indication of the memory size required before GC won’t remove the files?
Would caching by Lucee increase the needed memory size. I wonder if the size of the memory required needs to be larger than Lucee needs for a period of two days, ie until the Application times out?