nginx + default {deferred|bind} = корки

Alex Vorona voron at amhost.net
Mon May 21 12:19:36 MSD 2007


nest tmp # cat ./nginx.conf
user  apache apache;

worker_processes  1;

error_log /dev/null;
events {
        worker_connections  1000;
        use epoll;
}

http {

        server {
                listen          127.0.0.1:80;

                access_log      off;
                error_log       /dev/null;
                stub_status on;
        }

        server{
            listen      80 default deferred;
#            listen      80 default;

        }

}
nest tmp # ./nginx -t -c ./nginx.conf
2007/05/21 08:09:43 [info] 1416#0: the configuration file ./nginx.conf 
syntax is ok
2007/05/21 08:09:43 [info] 1416#0: the configuration file ./nginx.conf 
was tested successfully
nest tmp # ./nginx -c ./nginx.conf
Ошибка сегментирования (core dumped)
nest tmp # gdb ./nginx ./core
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
Reading symbols from /lib64/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /usr/lib64/libpcre.so.0...done.
Loaded symbols for /usr/lib/libpcre.so.0
Reading symbols from /usr/lib64/libssl.so.0.9.8...done.
Loaded symbols for /usr/lib/libssl.so.0.9.8
Reading symbols from /usr/lib64/libcrypto.so.0.9.8...done.
Loaded symbols for /usr/lib/libcrypto.so.0.9.8
Reading symbols from /lib64/libz.so.1...done.
Loaded symbols for /lib/libz.so.1
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libnss_compat.so.2...done.
Loaded symbols for /lib/libnss_compat.so.2
Reading symbols from /lib64/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib64/libnss_nis.so.2...done.
Loaded symbols for /lib/libnss_nis.so.2
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Core was generated by `./nginx -c ./nginx.conf'.
Program terminated with signal 11, Segmentation fault.
#0  ngx_vsnprintf (buf=0x7fa2035df3e1 "", max=<value optimized out>, 
fmt=<value optimized out>, args=0x7fa2035dfb90)
    at src/core/ngx_string.c:193
193                     len = s->len & 0xffff;
(gdb) bt
#0  ngx_vsnprintf (buf=0x7fa2035df3e1 "", max=<value optimized out>, 
fmt=<value optimized out>, args=0x7fa2035dfb90)
    at src/core/ngx_string.c:193
#1  0x0000000000405f20 in ngx_log_error_core (level=2, log=0x595010, err=98,
    fmt=0x44ebf8 "changing the listen() backlog to %d for %V failed, 
ignored") at src/core/ngx_log.c:108
#2  0x000000000040d7e0 in ngx_configure_listening_socket 
(cycle=0x594a60) at src/core/ngx_connection.c:406
#3  0x000000000040f4b2 in ngx_init_cycle (old_cycle=0x7fa2035dfdd0) at 
src/core/ngx_cycle.c:561
#4  0x0000000000405956 in main (argc=3, argv=0x7fa2035e0038) at 
src/core/nginx.c:291
(gdb) quit
nest tmp # strace -o /dev/stdout ./nginx -c ./nginx.conf|tail -n 20
stat("/var/tmp/nginx/proxy", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
mkdir("/var/tmp/nginx/fastcgi", 0700)   = -1 EEXIST (File exists)
stat("/var/tmp/nginx/fastcgi", {st_mode=S_IFDIR|0755, st_size=4096, 
...}) = 0
open("/dev/null", O_RDWR|O_APPEND|O_CREAT, 0644) = 3
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
open("/var/log/nginx/access_log", O_RDWR|O_APPEND|O_CREAT, 0644) = 5
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 7
setsockopt(7, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
ioctl(7, FIONBIO, [1])                  = 0
bind(7, {sa_family=AF_INET, sin_port=htons(80), 
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 8
setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
ioctl(8, FIONBIO, [1])                  = 0
bind(8, {sa_family=AF_INET, sin_port=htons(80), 
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
listen(7, 4294967295)                   = 0
setsockopt(7, SOL_TCP, TCP_DEFER_ACCEPT, [60], 4) = 0
listen(8, 4294967295)                   = -1 EADDRINUSE (Address already 
in use)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV (core dumped) +++
nest tmp # ./nginx -V
nginx version: nginx/0.5.20
built by gcc 4.1.1 (Gentoo 4.1.1-r3)
configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf 
--http-log-path=/var/log/nginx/access_log 
--error-log-path=/var/log/nginx/error_log --pid-path=/var/run/nginx.pid 
--http-client-body-temp-path=/var/tmp/nginx/client 
--http-proxy-temp-path=/var/tmp/nginx/proxy 
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --with-md5-asm 
--with-md5=/usr/include --with-http_realip_module --with-debug 
--with-http_ssl_module --with-http_stub_status_module --with-http_dav_module
nest tmp # uname -srm
Linux 2.6.20.3-grsec x86_64

аналогичное поведение при замене deferred на bind





More information about the nginx-ru mailing list