• Resolved Kim Hornung

    (@keepmovingdk)


    On our website, we have encountered an edge case where WP Super Cache occasionally serve blank pages to users.

    The problem is that the wp_cache_serve_cache_file() function doesn’t check if any content was successfully read from the cache file.

    This scenario only happens when external processes remove the cached files. In our case this happens from time to time because we’re using a NFS file system with two front-end servers that both access the files (the entire web root is on the NFS).

    But this means that a cache file can disappear between the call to file_exists() and the call to file_get_contents(). And in this situation, the empty string is then echo’ed.

    To fix this, please consider to change line 304-305 of wp-cache-phase2.php from:

    echo $cachefiledata;
    exit();

    To something along these lines:

    if ($cachefiledata === false) {
    wp_cache_debug( 'The wp-cache file could not be read. Must generate a new one.' );
    return false;
    }
    echo $cachefiledata;
    exit();

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there,

    I have let our devs know. They’ll get back to you after they take a look.

    Thanks!

    Plugin Author Donncha O Caoimh (a11n)

    (@donncha)

    Thanks @keepmovingdk for the patch. I’ll add that, but the readme.txt has warned about using an NFS share for the cache directory for a long time. It’s safer to use something like Batcache if you have multiple web servers.

    Plugin Author Donncha O Caoimh (a11n)

    (@donncha)

    This patch should resolve the problem. It’s not enough to check if it’s false once because if the data is gzipped before that, it will no longer be false.

    Thread Starter Kim Hornung

    (@keepmovingdk)

    Thank you the information about NFS and the suggestion to use something like Batcache.

    And I’m very happy to hear that you’ve prepared a patch, including several other checks than the one I had suggest. Sounds great!

    Plugin Support lastsplash (a11n)

    (@lastsplash)

    Hi @keepmovingdk

    The patch should be released in v1.12.5. Once the new version is out, please let us know if you still have issues.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.