清漆恐慌-废弃的原木(vsl)

时间:2018-10-24 07:18:07

标签: symfony varnish varnish-vcl panic debian-stretch

试图设置清漆,但是我从中得到了很多恐慌状态,无法弄清为什么以及如何修复它。

OS:Debian 9 清漆版本:尝试使用5.1、6和每周一次,行为相同

这是紧急日志:

Panic at: Wed, 24 Oct 2018 06:35:41 GMT
Wrong turn at cache/cache_main.c:284:
Signal 11 (Segmentation fault) received at 0x7fe81e4ace58 si_code 2
THIS PROBABLY IS A STACK OVERFLOW - check thread_pool_stack parameter
version = varnish-20181022-0 revision ba43ad1217623a31758dd5edb61ac941e8a38f54, vrt api = 8.0
ident = Linux,4.9.0-4-amd64,x86_64,-junix,-smalloc,-sdefault,-hcritbit,epoll
now = 6214590.919462 (mono), 1540362940.573062 (real)
Backtrace:
  0x55ca6b34a887: /usr/sbin/varnishd(+0x4c887) [0x55ca6b34a887]
  0x55ca6b3b3cb0: /usr/sbin/varnishd(VAS_Fail+0x40) [0x55ca6b3b3cb0]
  0x55ca6b346293: /usr/sbin/varnishd(+0x48293) [0x55ca6b346293]
  0x7fe81d3420c0: /lib/x86_64-linux-gnu/libpthread.so.0(+0x110c0) [0x7fe81d3420c0]
  0x7fe81de9e2e2: /lib/x86_64-linux-gnu/libpcre.so.3(+0x282e2) [0x7fe81de9e2e2]
  0x7fe81dec59a8: /lib/x86_64-linux-gnu/libpcre.so.3(+0x4f9a8) [0x7fe81dec59a8]
  0x7fe81de9cbc8: /lib/x86_64-linux-gnu/libpcre.so.3(pcre_exec+0xde8) [0x7fe81de9cbc8]
  0x55ca6b3bb006: /usr/sbin/varnishd(VRE_exec+0x76) [0x55ca6b3bb006]
  0x55ca6b360e28: /usr/sbin/varnishd(VRT_regsub+0xc8) [0x55ca6b360e28]
  0x7fe815865158: vcl_boot.1540361727.017502/vgc.so(VGC_function_vcl_recv+0x1c8) [0x7fe815865158]
thread = (cache-worker)
thr.req = 0x7fe8156ee020 {
  vxid = 131108, transport = ESI_INCLUDE
  step = R_STP_RECV,
  req_body = R_BODY_NONE,
  restarts = 0, esi_level = 5,
  sp = 0x7fe8144afa20 {
    fd = 26, vxid = 262145,
    t_open = 1540362926.300922,
    t_idle = 1540362926.312884,
    ws = 0x7fe8144afa60 {
      id = \"ses\",
      {s, f, r, e} = {0x7fe8144afa98, +96, (nil), +352},
    },
    transport = HTTP/1 {
      state = HTTP1::Proc
    }
    client = 127.0.0.1 51310 :80,
  },
  worker = 0x7fe81e4b6de0 {
    ws = 0x7fe81e4b6e88 {
      id = \"wrk\",
      {s, f, r, e} = {0x7fe81e4b63e0, +1128, (nil), +2040},
    },
    VCL::method = inside RECV,
    VCL::return = 0x0,
    VCL::methods = {RECV, PASS, HASH, MISS, DELIVER},
  },
  ws = 0x7fe8156ee170 {
    id = \"req\",
    {s, f, r, e} = {0x7fe8156f00a8, +928, (nil), +57168},
  },
  http_conn = 0x7fe8156f0048 {
    doclose = NULL,
    ws = (nil) {
    },
    {rxbuf_b, rxbuf_e} = {(nil), (nil)},
    {pipeline_b, pipeline_e} = {(nil), (nil)},
    content_length = 0,
    body_status = none,
    first_byte_timeout = 0.000000,
    between_bytes_timeout = 0.000000,
  },
  http[req] = 0x7fe8156ee210 {
    ws = 0x7fe8156ee170 {
      [Already dumped, see above]
    },
    hdrs {
      \"GET\",
      \"/_fragment?_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3DBirdOfficeBundle%253ASiteBo%253Aheader&_hash=Oo0WpoAySPXYqLOg%2B3MOD0kR1LnT%2B7sB7DKPmd%2Fg0B4%3D\",
      \"HTTP/1.1\",
      \"Host: www.my-site.com\",
      \"Upgrade-Insecure-Requests: 1\",
      \"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36\",
      \"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",
      \"Referer: https://www.my-site.com/recherche-salle/toutes-nos-salles\",
      \"Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7\",
      \"X-Forwarded-Proto: https\",
      \"X-Forwarded-Proto: https\",
      \"x-forwarded-for: 122.254.194.23, 168.63.64.97, 127.0.0.1, 127.0.0.1\",
      \"Cookie: ;boLang=default; ry_ry-b1rd0ff_realytics=eyJpZCI6InJ5XzI3N0I3QTRFLTYxQ0QtNEY1RS04NkUwLUJEMjlFNjAyMTk2MCIsImNpZCI6bnVsbCwiZXhwIjoxNTcxNDU1ODg2ODIzfQ%3D%3D; hubspotutk=4fa236c2f118d00ace78e86d4b79754d; cto_lwid=b9e886ae-69a0-47c1-b515-5f9622f085c1; ajs_user_id=null; ajs_group_id=null; ajs_anonymous_id=%227dd18a77-7f4e-4ea8-81ad-8bc922872fb6%22; cookieDisc=1; isCachable=1; noCache=1; ry_ry-b1rd0ff_so_realytics=eyJpZCI6InJ5XzI3N0I3QTRFLTYxQ0QtNEY1RS04NkUwLUJEMjlFNjAyMTk2MCIsImNpZCI6bnVsbCwib3JpZ2luIjp0cnVlLCJyZWYiOm51bGwsImNvbnQiOm51bGx9; __hstc=192717493.4fa236c2f118d00ace78e86d4b79754d.1539919896589.1540359864372.1540362919009.17; __hssrc=1; __hssc=192717493.2.1540362919009; SESS=444m7eduprfu33dqngejkc11n8\",
    },
  },
  vcl = {
    name = \"boot\",
    busy = 12,
    discard = 0,
    state = auto,
    temp = warm,
    conf = {
      srcname = {
        \"/etc/varnish/default.vcl\",
        \"Builtin\",
      },
    },
  },
  vmods = {
    std = {Varnish 20181022-0 ba43ad1217623a31758dd5edb61ac941e8a38f54, 0.0},
    directors = {Varnish 20181022-0 ba43ad1217623a31758dd5edb61ac941e8a38f54, 0.0},
  },
  flags = {
  },
  privs = 0x7fe8156ee1f8 {
  },
},
thr.busyobj = (nil) {
},

和我的清漆conf:

vcl 4.0;

import std;
import directors;

# Default backend definition. Set this to point to your content server.
backend apache_server {
  .host = "127.0.0.1";
  .port = "8080";
}

acl purge_ip {
    "localhost";
    "127.0.0.1";
}

sub vcl_recv {


    # Check correct header
    if (req.method != "GET" &&
        req.method != "HEAD" &&
        req.method != "PUT" &&
        req.method != "POST" &&
        req.method != "TRACE" &&
        req.method != "OPTIONS" &&
        req.method != "PURGE" &&
        req.method != "BAN" &&
        req.method != "DELETE") {
        /* Non-RFC2616 or CONNECT which is weird. */
        return (pipe);
    }

    if (req.restarts == 0) {
      if (req.http.x-forwarded-for) {
          set req.http.X-Forwarded-For =
          req.http.X-Forwarded-For + ", " + client.ip;
      } else {
          set req.http.X-Forwarded-For = client.ip;
      }
    }

    if (req.http.Cookie) {
        # Some generic cookie manipulation, useful for all templates that follow
        # Remove the "has_js" cooki
        set req.http.Cookie = ";" + req.http.Cookie;
        set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
        set req.http.Cookie = regsuball(req.http.Cookie, ";(PHPSESSID)=", "; \1=");
        set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
        set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

        # Remove any Google Analytics based cookies
        set req.http.Cookie = regsuball(req.http.Cookie, "__utm.=[^;]+(; )?", "");
        set req.http.Cookie = regsuball(req.http.Cookie, "_ga=[^;]+(; )?", "");
        set req.http.Cookie = regsuball(req.http.Cookie, "_gat=[^;]+(; )?", "");
        set req.http.Cookie = regsuball(req.http.Cookie, "utmctr=[^;]+(; )?", "");
        set req.http.Cookie = regsuball(req.http.Cookie, "utmcmd.=[^;]+(; )?", "");
        set req.http.Cookie = regsuball(req.http.Cookie, "utmccn.=[^;]+(; )?", "");

        # Remove DoubleClick offensive cookies
        set req.http.Cookie = regsuball(req.http.Cookie, "__gads=[^;]+(; )?", "");


        if (req.http.Cookie == "") {
            // If there are no more cookies, remove the header to get page cached.
            unset req.http.Cookie;
        }
    }


    # Allow purging
    if (req.method == "PURGE") {
         if (!client.ip ~ purge_ip) {
             #return(synth(405, "Not Found"));
             return(synth(403, "Not allowed"));
         }
         return (purge);
    }

    # Allow banning
    if (req.method == "BAN") {
        if (!client.ip ~ purge_ip) {
            return (synth(405, "Not allowed"));
        }

        if (req.http.X-Cache-Tags) {
            ban("obj.http.X-Host ~ " + req.http.X-Host
                + " && obj.http.X-Url ~ " + req.http.X-Url
                + " && obj.http.content-type ~ " + req.http.X-Content-Type
                + " && obj.http.X-Cache-Tags ~ " + req.http.X-Cache-Tags
            );
        } else {
            ban("obj.http.X-Host ~ " + req.http.X-Host
                + " && obj.http.X-Url ~ " + req.http.X-Url
                + " && obj.http.content-type ~ " + req.http.X-Content-Type
            );
        }

        return (synth(200, "Banned"));
    }

    # Don't cache POST request
    if (req.method ~ "POST") {
        return (pass);
    }

    # Don't cache FOS UserBundle security areas
    if (req.url ~ "(^/app.php|^/app_dev.php|^)/(([a-z]{2}/|)(login|logout|login_check).*)") {
        return (pass);
    }

    # Only cache GET or HEAD requests.
    if (req.method != "GET" && req.method != "HEAD") {
        return (pipe);
    }

    # Send Surrogate-Capability headers to announce ESI support to backend
    set req.http.Surrogate-Capability = "key=ESI/1.0";


    return (hash);
}


sub vcl_hash {
    hash_data(req.url);
    return (lookup);
}

sub vcl_backend_response {
  # Pause ESI request and remove Surrogate-Control header
  if (beresp.http.Surrogate-Control ~ "ESI/1.0") {
    unset beresp.http.Surrogate-Control;
    set beresp.do_esi = true;
  }

   std.collect(beresp.http.Set-Cookie, "; ");

 if ( beresp.http.Set-Cookie && beresp.http.Set-Cookie ~ "isCachable" ) {
        set beresp.http.X-Cacheable = "YES";
        unset beresp.http.Set-Cookie;
  }else{
    return (pass);
  }

   # Called after the response headers has been successfully retrieved from the backend.



   set beresp.http.X-Url = bereq.url;
    set beresp.http.X-Host = bereq.http.host;
    return (deliver);
}

sub vcl_deliver {
    # Add dev response, if X-Cache-Debug header exists
    if (!resp.http.X-Cache-Debug) {
        unset resp.http.X-Url;
        unset resp.http.X-Host;
        unset resp.http.X-Cache-Tags;
    }else{
      if (obj.hits > 0) {
          set resp.http.X-Cache = "HIT";
          set resp.http.X-Cache-Hits = obj.hits;
      } else {
          set resp.http.X-Cache = "MISS";
      }
    }

}

sub vcl_synth {
    set resp.http.Content-Type = "text/html; charset=utf-8";
    set resp.http.Retry-After = "5";
    synthetic ("Error");
    return (deliver);
}

我试图增加线程池和thread_pool_stack,但是仍然是同样的问题。 任何帮助将不胜感激

1 个答案:

答案 0 :(得分:1)

问题解决了。

thread_pool_stack的大小是问题所在,但是一旦增加清漆的价值,我便会重新启动清漆。

我意识到thread_pool_stack在重启时正在重置。

要修改thread_pool_stack值:

varnishadm param.set thread_pool_stack <value> (4k multiple)