Opened 11 years ago

Closed 11 years ago

#299 closed defect (worksforme)

Connect Peer Segmentation Fault

Reported by: Yasar Semih Alev Owned by:
Priority: critical Milestone:
Component: nginx-core Version: 1.3.x
Keywords: Cc:
uname -a: FreeBSD dev.local 8.2-RELEASE-p9 FreeBSD 8.2-RELEASE-p9 #0: Mon Jun 11 23:00:11 UTC 2012 amd64
nginx -V: nginx version: nginx/1.3.10
built by gcc 4.2.1 20070719 [FreeBSD]
TLS SNI support enabled
configure arguments: --user=nginx --group=nginx --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --pid-path=/var/run/ --lock-path=/var/lock/subsys/nginx --with-http_secure_link_module --with-http_random_index_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_geoip_module --with-http_spdy_module --with-mail --with-debug --with-mail_ssl_module --with-file-aio --with-http_secure_link_module --with-cc-opt='-O2 -g -m64 -mtune=generic' --add-module=ngx_http_bytes_filter_module --add-module=ngx_udplog_module --add-module=ngx_cache_purge --add-module=ngx_upstream_check_module --add-module=ngx_fluentd_module --add-module=ngx_lua_module --add-module=ngx_devel_kit


Dear All,

This week we received a lot of segmentation fault. I debugged and you can see below my gdb examine.

#0 0x000000000042dc5b in ngx_event_connect_peer (pc=0x8551b43f0) at src/event/ngx_event_connect.c:30
30 s = ngx_socket(pc->sockaddr->sa_family, SOCK_STREAM, 0);

(gdb) bt
#0 0x000000000042dc5b in ngx_event_connect_peer (pc=0x8551b43f0) at src/event/ngx_event_connect.c:30
#1 0x000000000045ce2d in ngx_http_upstream_connect (r=0x801ffd050, u=0x8551b43e0) at src/http/ngx_http_upstream.c:1135
#2 0x000000000045eb1d in ngx_http_upstream_init_request (r=0x801ffd050) at src/http/ngx_http_upstream.c:660
#3 0x0000000000453065 in ngx_http_read_client_request_body (r=0x801ffd050, post_handler=0x45ef90 <ngx_http_upstream_init>) at src/http/ngx_http_request_body.c:159
#4 0x00000000004846a7 in ngx_http_proxy_handler (r=0x801ffd050) at src/http/modules/ngx_http_proxy_module.c:703
#5 0x0000000000444edc in ngx_http_core_content_phase (r=0x801ffd050, ph=0x8020df068) at src/http/ngx_http_core_module.c:1411
#6 0x000000000043f82d in ngx_http_core_run_phases (r=0x801ffd050) at src/http/ngx_http_core_module.c:891
#7 0x000000000044a949 in ngx_http_process_request (r=0x801ffd050) at src/http/ngx_http_request.c:1678
#8 0x000000000044b88e in ngx_http_process_request_line (rev=0x802a0ddf0) at src/http/ngx_http_request.c:915
#9 0x000000000042ca34 in ngx_event_process_posted (cycle=0x801632050, posted=0x6227b0) at src/event/ngx_event_posted.c:40
#10 0x0000000000433a46 in ngx_worker_process_cycle (cycle=0x801632050, data=Variable "data" is not available.
) at src/os/unix/ngx_process_cycle.c:807
#11 0x000000000043237c in ngx_spawn_process (cycle=0x801632050, proc=0x433980 <ngx_worker_process_cycle>, data=0x11, name=0x4dc7bc "worker process", respawn=51) at src/os/unix/ngx_process.c:198
#12 0x0000000000434a16 in ngx_master_process_cycle (cycle=0x801632050) at src/os/unix/ngx_process_cycle.c:619
#13 0x00000000004164de in main (argc=Variable "argc" is not available.
) at src/core/nginx.c:412

(gdb) p pc->sockaddr
$1 = (struct sockaddr *) 0x0

I think peer connection sockaddr is null.


Kind Regards

Change History (5)

comment:1 by Maxim Dounin, 11 years ago

First of all, please upgrade to 1.3.12 (or at least 1.3.11) - there are at least one known problem in 1.3.10 with logging which might result various segmentation faults. If the problem still persists, please make sure you are able to reproduce the problem without 3rd party modules/patches.

comment:2 by Yasar Semih Alev, 11 years ago

Okey, I will try.

comment:3 by Yasar Semih Alev, 11 years ago

Hi Maxim,

I exactly solved the problem, i added small patch to ngx_event_connect.c for the null sockaddr and create a log for this. A day later check the log files and one of hostname in upstream server cant resolve so nginx create null sockaddr, the one of nameserver cant answer. The problem is hostname but nginx can handle this problem.


Kind Regards

comment:4 by Maxim Dounin, 11 years ago

Could you please elaborate - do you see null sockaddr in connect without any 3rd party modules?

comment:5 by Maxim Dounin, 11 years ago

Resolution: worksforme
Status: newclosed

Feedback timeout.

Note: See TracTickets for help on using tickets.