[bug] coredump при нефункционирующем resolver'е

Alexandre Snarskii snar на snar.spb.ru
Вт Окт 19 14:55:00 MSD 2010


Hi!

nginx/0.8.52, соответствующая часть конфига: 

        location ~* http://(.*):([0-9]+) { 
                internal;
                resolver 127.0.0.1;
                proxy_pass http://$1:$2/$request_uri$is_args$args;
                proxy_redirect .....;
        }

на этот location идет переход из fastcgi_pass (весь вывод которого
X-Accel-Redirect: http://<censored.a.bit>:80). Если named на localhost'е
работает - все прекрасно, но если его опустить (/etc/rc.d/named stop) - 
получаем корку: 

Program received signal SIGSEGV, Segmentation fault.
0x0804d710 in ngx_log_error_core (level=4, log=0x28511354, err=61, 
    fmt=0x80dcb7b "recv() failed") at src/core/ngx_log.c:93
93          if (log->file->fd == NGX_INVALID_FILE) {
(gdb) p log
$1 = (ngx_log_t *) 0x28511354
(gdb) p log->file
$2 = (ngx_open_file_t *) 0x0
(gdb) p *log
$3 = {log_level = 4, file = 0x0, connection = 0, 
  handler = 0x80667f0 <ngx_resolver_log_error>, data = 0x28511340, 
  action = 0x80db72c "resolving"}
(gdb) bt full
#0  0x0804d710 in ngx_log_error_core (level=4, log=0x28511354, err=61, 
    fmt=0x80dcb7b "recv() failed") at src/core/ngx_log.c:93
        args = 0x28510c09 "http://<censored.a.bit>:80>"
        p = (u_char *) 0x285d3849 "_"
        last = (u_char *) 0xbfbfd898 "ьь©©}Ч\006\b\200\021`(="
        msg = (
    u_char *) 0x283f7e4a "Y[\211\b╦ЪЪЪЪ╨ЪЪЪЪц\220\220\220\220\220\220\220Хл\235ТЪ\201ас\n\001"
        errstr = "\000\000\000\000\000р©©\000\000\000\000\000\000\001\000\r\000\000\000\000\000\000\000╫п©©", '\0' <repeats 12 times>, "8\211@(╠п©©\234ж©©╦я©©\025\217=(╠п©©╗р©©П\003\000\000\000р©©Lр©©=я©©\001\000\000\000\001\212=(Ъ\004snar\003spb\002ru\000\000\0004с©©\204р©©\200р©©\030в©©\034с©©\000\000\000\000\200р©©$ж©©\000\000\001\000\r\000\000\000\000\000\000\000=я©©", '\0' <repeats 12 times>, "8\211@(1я©©\034в©©8р©©\025\217=(1я©©(с©©П\003\000\000\200р©©"...
#1  0x0805d720 in ngx_connection_error (c=0x28601180, err=61, 
    text=0x80dcb7b "recv() failed") at src/core/ngx_connection.c:1015
        level = 4
#2  0x0806fe7d in ngx_udp_unix_recv (c=0x28601180, buf=0xbfbfd900 "Ъ", 
    size=4096) at src/os/unix/ngx_udp_recv.c:55
        n = -1
        err = 61
        rev = (ngx_event_t *) 0x287010f0
#3  0x080648c1 in ngx_resolver_read_response (rev=0x287010f0)
    at src/core/ngx_resolver.c:952
---Type <return> to continue, or q <return> to quit---
        n = 9
        c = (ngx_connection_t *) 0x28601180
        buf = "Ъ\000\000\000\000\220](t╬\017\bЪ\004snar\003spb\002ru\000\000\000ы\000\000\000\004\000\000\000\000\000\000\000\004\000\000\0008\211@(\000\220](\000ПЪЪ\230ы©©K\0338(\001\000\000\000\000\000\000\000 include /usr/lo\020\000\000\000╓╬\017\bng\000\001\000@\000\000t╬\017\b\000@\000\000rams\n#0:,\n\000\000ЪЪЪЪ\000\000\000\000\000\000\000\000\020@\000\0008\211@(\000\220](8\211@(\000\000\000\000АE8(\000\220](╔\000\000\000\000@\000\000p\006P(\000\000\000\000\000\000\000\000═╬\017\bл\nP\000t╬\017\b\000@\000\000"...
#4  0x0807728e in ngx_kqueue_process_events (cycle=0x28549028, timer=5000, 
    flags=1) at src/event/modules/ngx_kqueue_module.c:683
        events = 1
        n = 1
        i = 0
        instance = 0
        level = 7
        err = 0
        ev = (ngx_event_t *) 0x287010f0
        queue = (ngx_event_t **) 0x1388
        ts = {tv_sec = 5, tv_nsec = 0}
        tp = (struct timespec *) 0xbfbfe954
#5  0x080687bf in ngx_process_events_and_timers (cycle=0x28549028)
    at src/event/ngx_event.c:245
        flags = 1
---Type <return> to continue, or q <return> to quit---
        timer = 5000
        delta = 3289159096
#6  0x08073b96 in ngx_worker_process_cycle (cycle=0x28549028, data=0x0)
    at src/os/unix/ngx_process_cycle.c:795
        i = 1
        c = (ngx_connection_t *) 0xbfbfec98
#7  0x080712da in ngx_spawn_process (cycle=0x28549028, 
    proc=0x8073a20 <ngx_worker_process_cycle>, data=0x0, 
    name=0x80dd499 "worker process", respawn=1)
    at src/os/unix/ngx_process.c:196
        on = 1
        pid = 0
        s = 1
#8  0x08073718 in ngx_reap_children (cycle=0x28549028)
    at src/os/unix/ngx_process_cycle.c:612
        i = 1
        n = 2
        live = 0
        ch = {command = 2, pid = 33030, slot = 1, fd = -1}
        ccf = (ngx_core_conf_t *) 0x80f239c
#9  0x08072799 in ngx_master_process_cycle (cycle=0x28549028)
    at src/os/unix/ngx_process_cycle.c:180
        title = 0x2857708b ""
        p = (u_char *) 0x285770af "(\a"
---Type <return> to continue, or q <return> to quit---
        size = 37
        i = 1
        n = 0
        sigio = 0
        set = {__bits = {0, 0, 0, 0}}
        itv = {it_interval = {tv_sec = 0, tv_usec = 0}, it_value = {
    tv_sec = 0, tv_usec = 0}}
        live = 1
        delay = 0
        ls = (ngx_listening_t *) 0x6
        ccf = (ngx_core_conf_t *) 0x2854934c
#10 0x0804c041 in main (argc=1, argv=0xbfbfec90) at src/core/nginx.c:401
        i = 46
        log = (ngx_log_t *) 0x80f216c
        cycle = (ngx_cycle_t *) 0x28535028
        init_cycle = {conf_ctx = 0x0, pool = 0x2852d400, log = 0x80f216c, 
  new_log = {log_level = 0, file = 0x0, connection = 0, handler = 0, 
    data = 0x0, action = 0x0}, files = 0x0, free_connections = 0x0, 
  free_connection_n = 0, listening = {elts = 0x0, nelts = 0, size = 0, 
    nalloc = 0, pool = 0x0}, pathes = {elts = 0x0, nelts = 0, size = 0, 
    nalloc = 0, pool = 0x0}, open_files = {last = 0x0, part = {elts = 0x0, 
      nelts = 0, next = 0x0}, size = 0, nalloc = 0, pool = 0x0}, 
  shared_memory = {last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, 
    size = 0, nalloc = 0, pool = 0x0}, connection_n = 0, files_n = 0, 
---Type <return> to continue, or q <return> to quit---
  connections = 0x0, read_events = 0x0, write_events = 0x0, old_cycle = 0x0, 
  conf_file = {len = 31, data = 0x80d9c18 "/usr/local/etc/nginx/nginx.conf"}, 
  conf_param = {len = 0, data = 0x0}, conf_prefix = {len = 21, 
    data = 0x80d9c18 "/usr/local/etc/nginx/nginx.conf"}, prefix = {len = 21, 
    data = 0x80d9c00 "/usr/local/etc/nginx/"}, lock_file = {len = 0, 
    data = 0x0}, hostname = {len = 0, data = 0x0}}
        ccf = (ngx_core_conf_t *) 0x28535870

PS: nginx собран из портов FreeBSD, без особых добавок (+ipv6, +debug, +ssl).
Найдено на linux'е (+ssl only). 

nginx version: nginx/0.8.52
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx-error.log --user=www --group=www --with-debug --with-ipv6 --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx-access.log --with-http_ssl_module --with-http_stub_status_module --with-pcre

-- 
In theory, there is no difference between theory and practice. 
But, in practice, there is. 




Подробная информация о списке рассылки nginx-ru