A bit of a tangent, but does that batch file actually restart CF? I’ve never been able to just do a net stop and net start because the command line returns before the service is actually stopped, and the start is ineffective since the service is still stopping. I’ve always used sys internals psservice.exe command which has a restart.
Also, in regards to freeing up memory-- Are you concerned with “freeing up” data which was purposefully cached by your apps to boost performance. Most app servers actually warm up and improve in performance after running for a while. This is especially true of a hotspot compiler. MS SQL also caches a large amount of execution plans and often-used data for improve performance I don’t like to restart services unnecessarily unless they’re hung or there’s an actual memory leak. If SQL or CF are taking up too much ram, throttle them. SQL has a max memory usage setting and CF has the heap space. The SQL setting is especially important if SQL is running on the same box as other app servers, as MS SQL likes to expand until it’s taken all the RAM it can find unless you give it a max.
Now, all that being said-- I do occasionally get errors similar to what you posted when I reinit under load. I’m hoping my upgrade to CB 3.5.2 fixes some of that with the new thread safe stuff in WireBox.
I’ve never tried this, but if you really must restart, stop the IIS service first, then restart CF, then start IIS back up. This will keep people/bots from hitting the site while CF is coming back up.
ColdBox Platform Evangelist
Ortus Solutions, Corp