Problem/Motivation

Many temporary files of zero-length are left in public file system (sites/default/files)

Example:

-rw------- 1 nobody group 0 Feb 12 10:02 fileg5OAJZ
-rw------- 1 nobody group 0 Feb 12 10:02 fileeGXeCL
-rw------- 1 nobody group 0 Feb 12 14:24 fileSgt5Xw
-rw------- 1 nobody group 0 Feb 12 14:24 fileeScthS

I'm not 100% sure that this module is the cause, however, the following code in advagg.missing.inc:706 appears to create such files.

$temporary_file = drupal_tempnam(drupal_dirname($uri), 'file');

What other information can I provide?

Comments

mikeytown2’s picture

Status: Active » Fixed
StatusFileSize
new1.42 KB

Looks like a bug that was introduced with this change #2143913: Configure stream wrapper for storing aggregates

This patch has been committed.

mikeytown2’s picture

Cleanup code

$time_start = microtime(true);

$original = variable_get('drupal_stale_file_threshold', 2592000);
$GLOBALS['conf']['drupal_stale_file_threshold'] = 60;

$advagg_path = advagg_get_root_files_dir();
$top_level = substr($advagg_path[0][0], 0, strpos($advagg_path[0][0], 'advagg_css'));

$files = file_scan_directory($top_level, '/file.*/', array(
  'recurse' => FALSE,
  'callback' => 'drupal_delete_file_if_stale',
));
$GLOBALS['conf']['drupal_stale_file_threshold'] = $original;


$time_end = microtime(true);
$time = round($time_end - $time_start, 4);
echo "Cleanup took $time seconds\n";
mikeytown2’s picture

This patch has been committed. Created an update function that will remove these files if the file starts with file, size is 0 and is over 60 seconds old.

jtwalters’s picture

Wow, *high five* for the quick resolution. Thanks, mikeytown2.

Status: Fixed » Closed (fixed)

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