# ps axuww | grepc nginx
root     53135   0.0  0.4   68624  11676  -  Is   14:32       0:00.00 nginx:
master process /usr/local/sbin/nginx
www      53136   0.0  0.4   70672  13320  -  I    14:32       0:23.31 nginx:
worker process (nginx)
www      53137   0.0  0.4   70672  12060  -  I    14:32       0:12.39 nginx:
worker process (nginx)
www      53138   0.0  0.4   68624  12936  -  I    14:32       0:27.34 nginx:
worker process (nginx)
www      53139   0.0  0.4   70672  12488  -  I    14:32       0:23.35 nginx:
worker process (nginx)
www      53140   0.0  0.4   72720  12528  -  I    14:32       0:11.48 nginx:
worker process (nginx)
www      53141   0.0  0.3   66576  10580  -  S    14:32       0:22.22 nginx:
cache manager process (nginx)

# psext | grep nginx
  80 www        80 www      53141   normal  20  20  0  10580 kqread     
0:13.99  0:08.23 nginx: cache manager process (nginx)
   0 root        0 wheel    53135   normal  20  20  0  11676 pause      
0:00.00  0:00.00 nginx: master process /usr/local/sbin/nginx
  80 www        80 www      53136   normal  20  20  0  13320 soclos     
0:13.45  0:09.88 nginx: worker process (nginx)
  80 www        80 www      53137   normal  20  20  0  12060 soclos     
0:05.10  0:07.34 nginx: worker process (nginx)
  80 www        80 www      53138   normal  20  20  0  12936 soclos     
0:08.14  0:19.20 nginx: worker process (nginx)
  80 www        80 www      53139   normal  20  20  0  12488 soclos     
0:08.21  0:15.14 nginx: worker process (nginx)
  80 www        80 www      53140   normal  20  20  0  12528 soclos     
0:05.88  0:05.60 nginx: worker process (nginx)

# procstat -k $(pgrep nginx)
  PID    TID COMM             TDNAME           KSTACK
53141 101238 nginx            -                mi_switch
sleepq_catch_signals sleepq_wait_sig _sleep kqueue_kevent kern_kevent
sys_kevent amd64_syscall Xfast_syscall
53140 101281 nginx            -                mi_switch
sleepq_catch_signals sleepq_wait_sig _sleep soclose _fdrop closef closefp
amd64_syscall Xfast_syscall
53139 101117 nginx            -                mi_switch
sleepq_catch_signals sleepq_wait_sig _sleep soclose _fdrop closef closefp
amd64_syscall Xfast_syscall
53138 101095 nginx            -                mi_switch
sleepq_catch_signals sleepq_wait_sig _sleep soclose _fdrop closef closefp
amd64_syscall Xfast_syscall
53137 101200 nginx            -                mi_switch
sleepq_catch_signals sleepq_wait_sig _sleep soclose _fdrop closef closefp
amd64_syscall Xfast_syscall
53136 100605 nginx            -                mi_switch
sleepq_catch_signals sleepq_wait_sig _sleep soclose _fdrop closef closefp
amd64_syscall Xfast_syscall
53135 101161 nginx            -                mi_switch
sleepq_catch_signals sleepq_wait_sig _sleep kern_sigsuspend sys_sigsuspend
amd64_syscall Xfast_syscall

Как только я запускаю трейс для воркера, он сразу развисет и начинает
работать! soclos меняется на kqread

# truss -p 53138
close(47)                                        ERR#9 'Bad file
descriptor'
write(36,"2016/09/18 05:11:44 [crit] 53138"...,86) = 86 (0x56)
kevent(46,{ },0,{ 0,EVFILT_TIMER,EV_CLEAR,0x0,0x371a2,0x0
45,EVFILT_READ,0x0,0x0,0x40,0x802a0d960 },512,0x0) = 2 (0x2)
gettimeofday({ 1474180074.654655 },0x0)          = 0 (0x0)
recvmsg(0x2d,0x7fffffffe770,0x0)                 = 32 (0x20)
close(3)                                         = 0 (0x0)
recvmsg(0x2d,0x7fffffffe770,0x0)                 = 32 (0x20)
recvmsg(0x2d,0x7fffffffe770,0x0)                 ERR#35 'Resource
temporarily unavailable'
write(35,"212.109.218.47 - - [18/Sep/2016:"...,151) = 151 (0x97)
write(7,"181.208.179.6 - - [18/Sep/2016:0"...,157) = 157 (0x9d)
kevent(46,{ },0,{ 0,EVFILT_TIMER,EV_CLEAR,0x0,0x1,0x0 },512,0x0) = 1 (0x1)
gettimeofday({ 1474180074.674655 },0x0)          = 0 (0x0)
kevent(46,{ },0,{ 0,EVFILT_TIMER,EV_CLEAR,0x0,0x1,0x0 },512,0x0) = 1 (0x1)
gettimeofday({ 1474180074.809470 },0x0)          = 0 (0x0)
kevent(46,{ },0,{ 0,EVFILT_TIMER,EV_CLEAR,0x0,0x1,0x0 },512,0x0) = 1 (0x1)
gettimeofday({ 1474180074.873733 },0x0)          = 0 (0x0)
...

То же самое с gdb:

(gdb) attach 53141
...
(gdb) bt
#0  0x00000008017db778 in _close () from /lib/libc.so.7
#1  0x0000000801a41295 in pthread_suspend_all_np () from /lib/libthr.so.3
#2  0x000000000042561c in ngx_close_connection ()
#3  0x000000000044f7ce in ngx_http_process_request_uri ()
#4  0x0000000000433fd0 in ngx_event_expire_timers ()
#5  0x0000000000433796 in ngx_process_events_and_timers ()
#6  0x000000000043a9d8 in ngx_single_process_cycle ()
#7  0x0000000000439096 in ngx_spawn_process ()
#8  0x000000000043a289 in ngx_master_process_cycle ()
#9  0x0000000000439a55 in ngx_master_process_cycle ()
#10 0x0000000000413244 in main ()

(gdb) bt
#0  0x00000008017c398a in _kevent () from /lib/libc.so.7
#1  0x0000000801a41b82 in pthread_suspend_all_np () from /lib/libthr.so.3
#2  0x000000000043c185 in ngx_freebsd_sendfile_chain ()
#3  0x0000000000433764 in ngx_process_events_and_timers ()
#4  0x000000000043a9d8 in ngx_single_process_cycle ()
#5  0x0000000000439096 in ngx_spawn_process ()
#6  0x000000000043a289 in ngx_master_process_cycle ()
#7  0x0000000000439a55 in ngx_master_process_cycle ()
#8  0x0000000000413244 in main ()

Перед некоторыми запросами вот такое ещё появляется:

kevent(45,{ },0,{ 49,EVFILT_READ,EV_CLEAR,0x0,0x230,0x8026e1a88 },512,0x0) =
1 (0x1)
read(49,"\^W\^C\^C\^B+\0\0\0\0\0\0\0\^V]op#\M-&\M-QgRx\M->\M-|\M-^t)\M-w\M^KR\M^V\M-Wu\M-hYI\M-o/\M^V\M^A@\M^C\^W\M^X\^P\M^B\^F\^]\vs\M-i\^[\M-1\^^;\M-\\M-G\M-kq\M-$>\M^N\M^U\M^Je\M^HN\M--\M^C*\M-5\M-T\M-dT\M^BH88G_\M-wp\M-K\M-G\^Us\M--\M^E8\M-UZ\M-N\M-ea\M-IB\M^O"...,33093)
= 560 (0x230)
read(49,0x8028357c3,33093)                       ERR#35 'Resource
temporarily unavailable'
aio_read(0x8020689a0)                            = 0 (0x0)
aio_error(0x8020689a0)                           = 0 (0x0)
aio_return(0x8020689a0)                          = 2440 (0x988)
write(49,"\^W\^C\^C\^E\M-}\M-[&\M-qU\M-f\M-6\f\M-h\^S\M^PA\M^N\M-H\M-N\^U2\^U.\M^X1\M-K\M-W\M^U\M-K\M^Y[[\M-`\M^C\M^D\M-<'g-oV\M-L\M-RM\M-tr\M-0?\M^B\^\\M-a\M-M\^SR]\M-a\M-t\^RP<\^Y\M-!Q:~\M-:!AH\M^_\M^K\M-y\M-j\M-(\\~t\M^Ra^w\M-c\M-{9\M-(\M-P\M-d?F\M^IAQ%\M^@\M-S"...,1538)
= 1538 (0x602)

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?21,269501,269650#msg-269650

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Ответить