I'm getting this notice frequently (about every 8 hours) in dblog:
The file was not deleted, because it does not exist.
Any thoughts?

Comments

pmorel’s picture

I have the warning message with a drupal 7 beta 3 installation. The message comes from /includes/file.inc line 1260:

    watchdog('file', 'The file %path was not deleted, because it does not exist.', array('%path' => $path), WATCHDOG_NOTICE);    

I've displayed the backtrace and it seems to point to ctools (at least in my case):

Array
(
    [0] => Array
        (
            [file] => ~/includes/file.inc
            [line] => 1306
            [function] => file_unmanaged_delete
            [args] => Array
                (
                    [0] => ~/sites/default/files/ctools/css
                )

        )

    [1] => Array
        (
            [file] => ~/sites/all/modules/ctools/includes/css.inc
            [line] => 560
            [function] => file_unmanaged_delete_recursive
            [args] => Array
                (
                    [0] => public://ctools/css
                )

        )

    [2] => Array
        (
            [file] => ~/sites/all/modules/ctools/ctools.module
            [line] => 396
            [function] => ctools_css_flush_caches
            [args] => Array
                (
                )

        )

    [3] => Array
        (
            [function] => ctools_flush_caches
            [args] => Array
                (
                )

        )

    [4] => Array
        (
            [file] => ~/includes/module.inc
            [line] => 768
            [function] => call_user_func_array
            [args] => Array
                (
                    [0] => ctools_flush_caches
                    [1] => Array
                        (
                        )

                )

        )

    [5] => Array
        (
            [file] => ~/modules/system/system.module
            [line] => 2948
            [function] => module_invoke_all
            [args] => Array
                (
                    [0] => flush_caches
                )

        )

    [6] => Array
        (
            [function] => system_cron
            [args] => Array
                (
                )

        )

    [7] => Array
        (
            [file] => ~/includes/module.inc
            [line] => 768
            [function] => call_user_func_array
            [args] => Array
                (
                    [0] => system_cron
                    [1] => Array
                        (
                        )

                )

        )

    [8] => Array
        (
            [file] => ~/includes/common.inc
            [line] => 4950
            [function] => module_invoke_all
            [args] => Array
                (
                    [0] => cron
                )

        )

    [9] => Array
        (
            [file] => ~/cron.php
            [line] => 26
            [function] => drupal_cron_run
            [args] => Array
                (
                )

        )

)

It looks like the following function should not be executed when running cron (as the comment suggests) but for some reason, the "variable_get('cron_semaphore', FALSE)" test returns FALSE instead of TRUE as the cron_semaphore is set at the beginning of running cron using lock_acquire('cron').

/**
 * Ensure the CTools CSS cache is flushed whenever hook_flush_caches is invoked.
 */
function ctools_flush_caches() {
  // Do not actually flush caches if running on cron. Drupal uses this hook
  // in an inconsistent fashion and it does not necessarily mean to *flush*
  // caches when running from cron. Instead it's just getting a list of cache
  // tables and may not do any flushing.
  if (variable_get('cron_semaphore', FALSE)) {
    return;
  }

  ctools_include('css');
  ctools_css_flush_caches();
}

Hope this help as as a starting point (I'm not sure what's next as I have no clue of what/why/when this function ought to do).

pillarsdotnet’s picture

Good. — Fast. — Cheap.
(Pick any two.)

petey318’s picture

I am seeing this also ("The file was not deleted, because it does not exist.") and it happens at every cron run. I also have ctools loaded (required by Views).

pillarsdotnet’s picture

The problem and a possible correction has been reported; see the comment just previous to your own. The fix is described the following issue:

#1001836: file_unmanaged_delete() and file_unmanaged_delete_recursive() should check the return value of drupal_realpath() before using it

Unfortunately, that issue is still marked "needs review." You can help the process by applying the patch attached to comment #6.

  • If you have already tried the patch, and it doesn't solve your problem, please add a comment saying so, and change the status to "Needs Work."
  • If you have not tried the patch, please do so. If it works for you, then please add a comment saying so, and change the status to "Reviewed and Tested By the Community".
  • If you don't know how to apply a patch, please see http://drupal.org/patch/apply for further instructions.

Good. — Fast. — Cheap.
(Pick any two.)

loopy1492’s picture

Any thoughts on how to apply a patch through the admin interface or with PHP? I don't have access to the server.

pillarsdotnet’s picture

If you have (at least) FTP access, then:

  1. Download all relevant files to your computer.
  2. Apply the patch.
  3. Upload all relevant files to the server.

Good FTP programs will auto-detect which files have changed and only re-upload the changed files.

If you don't have FTP access then you cannot patch. Sorry.

Good. — Fast. — Cheap.
(Pick any two.)