Incomplete files in 3.0.x

Reinis Rozitis r at
Thu Nov 24 17:34:22 CET 2011

I have been using 2.1.5 for quite some time in a heavy environment and everything works as expected.

Now I'm trying to upgrade to 3.0.2 (just because of persistent storage possibility on a ssd disk) but in my tests I experience 
strange behaviour of Varnish - as it randomly caches incomplete image files - which display like half size on browsers.

It does happen on randomly pattern - when the storage file is deleted or in malloc case just restarted out of 40-50 requests I will 
sure get one file which is corrupted, but it doesn't reproduce on the same files.
So I have no idea where to start digging or am I doing something wrong - as in the config/startup options are not valid anymore for 
3.0.x ?

The config and startup is pretty simple and taken out of 2.1.x instances which have been working fine for a year with the minor 
changes of beresp.cachable replaced with beresp.ttl and hash_data

varnishd -f default.vcl -s persistent,/tmp/varnish,10m -h classic,500009 -p connect_timeout=60 -p thread_pools=8 -p 
thread_pool_min=100 -p thread_pool_max=5000 -thread_pool_add_delay=2 -p cli_timeout=50 -p session_linger=120 -p lru_interval=20

(-s persistent,/tmp/varnish,10m / -s malloc,10m - are just for testing purposes the original 2.1 instances run with 64Gb malloc)

backend default {
        .host = "";
        .port = "8080";
        .connect_timeout = 60s;
        .first_byte_timeout = 60s;
        .between_bytes_timeout = 60s;

sub vcl_recv {

   set req.grace = 30s;

   unset req.http.Cookie;
   unset req.http.Accept-Encoding;
   unset req.http.X-Forwarded-For;
   unset req.http.Cache-Control;

   set req.url = regsub(req.url, "\?.*", "");


sub vcl_hash {
    return (hash);

sub vcl_fetch {

    remove beresp.http.Server;
    set beresp.grace = 30s;

    if (beresp.ttl <= 0s) {
        return (hit_for_pass);

    if (beresp.ttl < 5m) {
             set beresp.ttl = 5m;

    return (deliver);

sub vcl_deliver {
        remove resp.http.Via;

        if (obj.hits > 0) {
                set resp.http.X-Cache = "HIT";

        return (deliver);

sub vcl_error {
        if (obj.status == 503 && req.restarts < 5) {
                return (restart);


More information about the varnish-misc mailing list