Whenever BM lists files in a destination it leaves a load of temporary files, mostly empty. These eventually get cleaned up by cron, but shouldn't be left behind in the first place. If you have a destination with a lot of files, and refresh the list multiple times before cron gets to clean up, you can end up with hundreds of files in /tmp.

It's only one line of code to fix it, patch follows.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RickJ created an issue. See original summary.

RickJ’s picture

Status: Active » Needs review
FileSize
240 bytes
DamienMcKenna’s picture

Assigned: RickJ » Unassigned

Thanks for that, RickJ, we'll try to review it soon.

BTW, the "assigned" field is for indicating you're actively working on something, once you've finished the work (or can't continue on it) it's preferred to set it back to "unassigned".

DamienMcKenna’s picture

Any recommendations for steps to reproduce the problem? Is it a particular destination that creates the temp files?

RickJ’s picture

I was getting this specifically using AWS S3, but I think I found it with other destinations. It was a while back, I just did a quick fix. I thought it was about time I posted it as a patch!

It occurs when you refresh a remote destination, and it builds a complete new listing. It's largely due to the implementation of the backup_file class - every time an object of this class is instantiated, it creates a temporary file on disk, even if that file is never used. In building the list, especially if it includes .info files, several backup_file objects are created for every file listed, and therefore lots of empty disk files.

You can find them all in /tmp on the host.

DamienMcKenna’s picture

Status: Needs review » Needs work

Ok, I was able to where the files were being created during a backup, and saw that there were some empty files that should have been cleaned up, but I think it needs to be narrowed down to trigger after the files are no longer needed.

RickJ’s picture

Status: Needs work » Needs review

The point where I've put the cleanup is exactly after the files are no longer needed!

All that's happening in the list_files function is that a list of backup filenames is being created, then cached. The process of acquiring the names uses backup_file objects, which creates the temporary files as a by-product. The content of the .info files is read in the call to load_files_info, at which point it's all in memory, enabling it to be cached.

Once the file list is written to cache it's in the same state as if it's been read from cache, neither of which any longer depends on the temporary disk files.

DamienMcKenna’s picture

Status: Needs review » Fixed
Parent issue: » #2942331: Plan for Backup and Migrate 7.x-3.6

Thanks RickJ. Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.