Text file busy

Richard B 3 months ago • updated by Vlad R 2 months ago 6

One of the areas I scan for files in a mount of the C: drive of a Windows 7 box.  Occasionally--not always--the operating system on this machine is doing something, so the scan aborts with this:

Warning: dir(/var/www/html/system/data/default_home_folder/NAS/Mediacenter/hiberfil.sys): failed to open dir: Text file busy in /var/www/html/system/classes/vendor/FileRun/Utils/FM.php on line 435
PHP Fatal error:  Call to a member function read() on boolean in /var/www/html/system/classes/vendor/FileRun/Utils/FM.php on line 437

Is there a parameter to search_index.php that would simply ignore this error and continue with the scan?

Under review

Sounds like a FileRun bug though. "dir()" is used for reading folders, while the path indicates a file, not a folder.

Can it be that you are pointing "search_index.php" directly at a file instead of a folder?

P.S. It is recommended to store or mount files outside the "www" path, to prevent unauthorized access to the files through the web server.

Yes, I'm still in functional test mode.  For production, I'll be revamping the mountpoints.

In my issue above, I have the C: drive of the server "Mediacenter" mounted via cifs to this directory:   /var/www/html/system/data/default_home_folder/NAS/Mediacenter

The command line that is causing the error is this:

php cron/search_index.php /var/www/html/system/data/default_home_folder/NAS/Mediacenter

For completeness's sake, I've also tried:

php cron/search_index.php /var/www/html/system/data/default_home_folder/NAS/Mediacenter/

Both generate the "Text file busy" error. 

I'm aware that this particular file is the Windows file used for the hibernate function.  However, it may be that all open files on a Windows box may throw this error.  There's no way to be sure until I can get the scan to get past hiberfil.sys.  For this particular box, I don't ever use the hibernate function, so later this weekend I will disable hibernation on this machine (powercfg.exe -h off) and delete hiberfil.sys and rescan.  I am concerned that open files during a recursive scan on Windows machines may cause this same error.  I'll follow up when I know more. In the meantime, it would be useful for search_index.php to gracefully recover from read errors and continue the scan.


I will try to reproduce the problem and find a solution for you. Stay tuned.

The solution would require a patch, which wouldn't be an easy solution. The alternative would be to wait a few weeks for the new FileRun version which will be released this month. Are you ok with that?

Perfectly fine, as if the delay didn't give me away.