Назад | Перейти на главную страницу

Varnish 4.1 остановлен после перезапуска и не запускается

Я обновился с Varnish 4.0 до 4.1, вначале у меня была одна небольшая проблема, я исправил ее и заработал. Мне нужно было очистить кеш, и когда я перезапустил Varnish, он сказал «Запускается», но при проверке статуса он показывает остановлен. Ничего не изменилось ни в системе, ни в конфигах. Varnish.log пуст, а сообщения показывают

Система: CentOS 6.7 Varnish: 4.1.0-1

Nov 30 23:30:42 www varnishd[16665]: Child (16667) not responding to CLI, killing it.
Nov 30 23:30:42 www varnishd[16665]: Child (16667) died signal=11 (core dumped)
Nov 30 23:30:42 www varnishd[16665]: Child (16667) Panic message:#012 Assert error in child_sigsegv_handler(), mgt/mgt_child.c line 297:#012  Condition(Segmentation fault by instruction at 0x205970) not true.#012thread = (cache-worker)#012version = varnish-4.1.0 revision 3041728#012ident = Linux,2.6.32-573.8.1.el6.x86_64,x86_64,-junix,-smalloc,-smalloc,-hcritbit,epoll#012Backtrace:#012  0x432483: varnishd() [0x432483]#012  0x450de9: varnishd() [0x450de9]#012  0x34a480f790: libpthread.so.0() [0x34a480f790]#012  0x43c2b9: varnishd(VCL_DefaultDirector+0x19) [0x43c2b9]#012  0x436b9e: varnishd(CNT_Request+0x74e) [0x436b9e]#012  0x44cc3b: varnishd(HTTP1_Session+0x11b) [0x44cc3b]#012  0x439921: varnishd(SES_Proto_Req+0x61) [0x439921]#012  0x447aed: varnishd() [0x447aed]#012  0x447eeb: varnishd() [0x447eeb]#012  0x34a4807a51: libpthread.so.0() [0x34a4807a51]#012req = 0x7fe026896020 {#012  vxid = 2, step = R_STP_RECV,#012  req_body = R_BODY_NONE,#012  restarts = 0, esi_level = 0,#012  sp = 0x7fe02640f420 {#012    fd = 13, vxid = 1,#012    client = 180.76.15.6 56796,#012    step = S_STP_H1PROC,#012  },#012  worker = 0x7fe02d7eebc0 {#012    stack = {0x7fe02d7ef000 -> 0x7fe02d7e3000},#012    ws = 0x7fe02d7eedb8 {#012      id = "wrk",#012      {s,f,r,e} = {0x7fe02d7ee380,0x7fe02d7ee380,(nil),+2040},#012    },#012    VCL::method = none,#012    ws = 0x7fe026896200 {#012      id = "req",#012      {s,f,r,e} = {0x7fe026898000,+216,(nil),+57336},#012    },#012    http_conn = 0x7fe026896128 {#012      fd = 13,#012      doclose = NULL,#012      ws = 0x7fe026896200,#012      {rxbuf_b, rxbuf_e} = {0x7fe026898000, 0x7fe0268980b8},#012      {pipeline_b, pipeline_e} = {(nil), (nil)},#012      content_length = -1,#012      body_status = none,#012      first_byte_timeout = 0.000000,#012      between_bytes_timeout = 0.000000,#012    },#012    http[req] = 0x7fe026896298 {#012      ws[req] = 0x7fe026896200,#012      hdrs {#012        "GET",#012        "/",#012        "HTTP/1.1",#012        "Host: wsww",#012        "Accept-Lang
Nov 30 23:30:42 www varnishd[16665]: child (17228) Started
Nov 30 23:30:43 www varnishd[16665]: Pushing vcls failed:#012Could not load compiled VCL.#012#011dlopen(vcl_boot/vgc.so) = vcl_boot/vgc.so: cannot open shared object file: No such file or directory
Nov 30 23:30:44 www varnishd[16665]: Child (17228) ended
Nov 30 23:30:44 www varnishd[16665]: Child (17228) said Child starts
Nov 30 23:30:44 www varnishd[16665]: Child (17228) said Child dies
Nov 30 23:32:20 www varnishd[16665]: Manager got SIGINT
Nov 30 23:32:24 www varnishd[18670]: Platform: Linux,2.6.32-573.8.1.el6.x86_64,x86_64,-junix,-smalloc,-smalloc,-hcritbit
Nov 30 23:32:24 www varnishd[18670]: child (18672) Started
Nov 30 23:32:24 www varnishd[18670]: Child (18672) said Child starts
Nov 30 23:32:51 www varnishd[18670]: Manager got SIGINT
Nov 30 23:32:52 www varnishd[18670]: Child (18672) ended
Nov 30 23:32:52 www varnishd[18670]: Child (18672) said Child die

Мой default.vcl, который работал нормально до последнего перезапуска службы, и был default.vcl, поставляемым с установкой:

#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and http://varnish-cache.org/trac/wiki/VCLExamples for more examples.

# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
vcl 4.0;

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

sub vcl_recv {
# Happens before we check if we have this in cache already.
#
# Typically you clean up the request here, removing cookies you don't need,
# rewriting the request, etc.
}

sub vcl_backend_response {
# Happens after we have read the response headers from the backend.
#
# Here you clean the response headers, removing silly Set-Cookie headers
# and other mistakes your backend does.
}
# Below is a commented-out copy of the default VCL logic.  If you
# redefine any of these subroutines, the built-in logic will be
# appended to your code.
sub vcl_recv {
 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;
    }
}
sub vcl_pipe {
#     # Note that only the first request to the backend will have
#     # X-Forwarded-For set.  If you use X-Forwarded-For and want to
#     # have it set for all requests, make sure to have:
  set bereq.http.connection = "close";
#     # here.  It is not set by default as it might break some broken web
#     # applications, like IIS with NTLM authentication.
 return (pipe);
}

Я запускаю ваш файл vcl с помощью varnish4.1 на centos6.5 (конечно, после его исправления) и вижу:

[root@node1 ~]# ls /var/lib/varnish/node1/ -R
/var/lib/varnish/node1/:
vcl_boot  _.vsm

/var/lib/varnish/node1/vcl_boot:
vgc.so

Причина, по которой у вас нет этого файла, проста: ваш файл vcl не скомпилирован должным образом. Исправьте ваш default.vcl (вы должны удалить неиспользуемые sub vcl_recv):

sub vcl_recv {
 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;
    }
}
} # <- add one more
Nov 30 23:30:43 www varnishd[16665]: Pushing vcls failed:#012Could not load compiled VCL.#012#011dlopen(vcl_boot/vgc.so) = vcl_boot/vgc.so: cannot open shared object file: No such file or directory

Я не уверен насчет этого, не могли бы вы вставить свои файлы .vcl? Я предполагаю, что это происходит из-за того, что ваш пользовательский плагин не может быть загружен.

Nov 30 23:31:53 www named[2444]: error (network unreachable) resolving 'www.amazon.it/A/IN': 2001:502:4612::1#53

Здесь еще раз проверьте, может ли ваш хост подключиться к DNS-серверу и разрешить имя вашего бэкэнда в файлах .vcl. Varnish компилирует файлы vcl при перезапуске и пытается разрешить весь бэкэнд с имени хоста / dns на IP, в случае неудачи он сломается.