春哥,你好!
我们在线上环境运行nginx -s reload 后,就会出现下面这种情况:
[root@VIP17 scripts]# ps -ef|grep nginx
root 2047 629 0 11:13 pts/9 00:00:00 grep nginx
root 32425 1 0 10:52 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody 32426 32425 0 10:52 ? 00:00:01 nginx: worker process is shutting down
nobody 32430 32425 0 10:52 ? 00:00:00 nginx: worker process is shutting down
nobody 32431 32425 0 10:52 ? 00:00:01 nginx: worker process is shutting down
nobody 32432 32425 0 10:52 ? 00:00:00 nginx: worker process is shutting down
nobody 32433 32425 0 10:52 ? 00:00:00 nginx: worker process is shutting down
nobody 32434 32425 0 10:52 ? 00:00:01 nginx: worker process is shutting down
nobody 32435 32425 0 10:52 ? 00:00:00 nginx: worker process is shutting down
nobody 32436 32425 0 10:52 ? 00:00:00 nginx: worker process is shutting down
nobody 32640 32425 0 10:54 ? 00:00:05 nginx: worker process
nobody 32641 32425 0 10:54 ? 00:00:04 nginx: worker process
nobody 32642 32425 0 10:54 ? 00:00:04 nginx: worker process
nobody 32643 32425 0 10:54 ? 00:00:09 nginx: worker process
nobody 32644 32425 0 10:54 ? 00:00:05 nginx: worker process
nobody 32645 32425 0 10:54 ? 00:00:04 nginx: worker process
nobody 32646 32425 0 10:54 ? 00:00:05 nginx: worker process
nobody 32647 32425 0 10:54 ? 00:00:06 nginx: worker process
#其中一个进程,pstack看到是这样的:
pstack 32426
#0 0x0000003e194d4473 in __epoll_wait_nocancel () from /lib64/libc.so.6
#1 0x0000000000420f9c in ngx_epoll_process_events ()
#2 0x000000000041a2c8 in ngx_process_events_and_timers ()
#3 0x000000000041fdd0 in ngx_worker_process_cycle ()
#4 0x000000000041e6e7 in ngx_spawn_process ()
#5 0x000000000041f473 in ngx_start_worker_processes ()
#6 0x0000000000420334 in ngx_master_process_cycle ()
#7 0x000000000040618a in main ()
strace -p 32426
Process 32426 attached - interrupt to quit
epoll_wait(35, <unfinished ...>
# 新启动的进程的:
pstack 32641
#0 0x0000003e194d4473 in __epoll_wait_nocancel () from /lib64/libc.so.6
#1 0x0000000000420f9c in ngx_epoll_process_events ()
#2 0x000000000041a2c8 in ngx_process_events_and_timers ()
#3 0x000000000041fdd0 in ngx_worker_process_cycle ()
#4 0x000000000041e6e7 in ngx_spawn_process ()
#5 0x000000000041f473 in ngx_start_worker_processes ()
#6 0x0000000000420921 in ngx_master_process_cycle ()
#7 0x000000000040618a in main ()
strace -p 32641
Process 32641 attached - interrupt to quit
epoll_wait(8, {{EPOLLIN|EPOLLOUT, {u32=3960849105, u64=47901436134097}}}, 512, 500) = 1
recvfrom(67, "POST /user/xxxx/ HTTP/1."..., 1024, 0, NULL, NULL) = 307
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 71
ioctl(71, FIONBIO, [1]) = 0
epoll_ctl(8, EPOLL_CTL_ADD, 71, {EPOLLIN|EPOLLOUT|EPOLLET, {u32=3960851984, u64=47901436136976}}) = 0
connect(71, {sa_family=AF_INET, sin_port=htons(9998), sin_addr=inet_addr("xx.xx.xx.xx")}, 16) = -1 EINPROGRESS (Operation now in progress)
recvfrom(67, 0x7fff3ee49d37, 1, 2, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(8, {{EPOLLOUT, {u32=3960851984, u64=47901436136976}}}, 512, 500) = 1
getsockopt(71, SOL_SOCKET, SO_ERROR, [-1435026707638648832], [4]) = 0
后面省略....
编译命令是这样的:
./configure --prefix=/usr/local/nginx-1.0.15_city_mod --with-http_stub_status_module \
--with-http_gzip_static_module --with-http_ssl_module --with-http_realip_module \
--with-openssl=/usr/local/openssl-1.0.1c --with-pcre=../pcre-8.10 \
--add-module=../nginx_tcp_proxy_module-0.4.4 \
--add-module=../nginx_upload_module-2.0.12 \
--add-module=../ngx_cache_purge-1.3 \
--with-ld-opt=-g \
--with-http_secure_link_module \
--add-module=/home/lxj/ngx_city_mod \
--add-module=/home/lxj/ngx_req_stat
其中最后面两个是自己的模块,一个是请求统计模块,一个是使用IP定位城市的模块。
操作系统版本:
lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.6 (Final)
Release: 5.6
Codename: Final
其中的req_stat模块,实现了init process 方法,里面启动了一个定时器,定时刷统计信息到mongodb中。
exit process
原来也有做刷新数据到mongodb中的操作,现在去掉了(开始我怀疑是这个引起的,后面确认去掉后问题依旧)。
出现这种问题,会是什么原因? 会是我自己的模块出问题导致的么?
jie123108