挂起工人进程php-fpm

时间:2014-02-09 17:54:00

标签: linux php

我1小时前在服务器上遇到了emegrency问题。 我用php5-fpm cgi + nginx。以下php代码导致cgi worker挂起。

$fp = fsockopen("localhost", 6699, $errno, $errstr, 30);
$result = '';
if (!$fp) {
    $this->SysLog2(ALERT, "Unable to send command to RmServer. $errstr ($errno)");
} else {
    fwrite($fp, $command);
    while (!feof($fp)) {
        $result .= fgets($fp, 128);
    }
    fclose($fp);
}

#0  0x00007f58ac392313 in __GI___poll (fds=<optimized out>, nfds=<optimized out>, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:87
#1  0x00000000006682f4 in ?? ()
#2  0x0000000000470d8a in ?? ()
#3  0x000000000065b708 in ?? ()
#4  0x000000000065c3d9 in _php_stream_get_line ()
#5  0x00000000005daefd in zif_fgets ()
#6  0x000000000070f52d in ?? ()
#7  0x00000000006c009b in execute ()
#8  0x000000000069b600 in zend_execute_scripts ()
#9  0x0000000000647c73 in php_execute_script ()
#10 0x000000000042ba55 in ?? ()
#11 0x00007f58ac2cb76d in __libc_start_main (main=0x42ab00, argc=3, ubp_av=0x7fffa0becca8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
stack_end=0x7fffa0becc98) at libc-start.c:226
#12 0x000000000042c2b5 in _start ()

[09-Feb-2014 21:30:28.789264] DEBUG: pid 10529, fpm_scoreboard_init_main(), line 40: got clock tick '100'
[09-Feb-2014 21:30:28.789503] DEBUG: pid 10529, fpm_event_init_main(), line 331: event module is epoll and 3 fds have been reserved
[09-Feb-2014 21:30:28.789576] NOTICE: pid 10529, fpm_init(), line 80: fpm is running, pid 10529
[09-Feb-2014 21:30:28.789603] DEBUG: pid 10529, fpm_pctl_heartbeat(), line 460: heartbeat have been set up with a timeout of 3333ms
[09-Feb-2014 21:30:28.789617] DEBUG: pid 10529, fpm_event_loop(), line 360: 1280 bytes have been reserved in SHM
[09-Feb-2014 21:30:28.789624] NOTICE: pid 10529, fpm_event_loop(), line 361: ready to handle connections
[09-Feb-2014 21:30:29.790664] DEBUG: pid 10529, fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 0 active children, 0 spare children
[09-Feb-2014 21:30:31.947235] DEBUG: pid 10529, fpm_children_make(), line 421: [pool www] child 10530 started
[09-Feb-2014 21:30:31.947278] DEBUG: pid 10529, fpm_pctl_on_socket_accept(), line 536: [pool www] got accept without idle child available .... I forked
[09-Feb-2014 21:30:31.947286] DEBUG: pid 10529, fpm_event_loop(), line 409: event module triggered 1 events
[09-Feb-2014 21:30:32.794231] DEBUG: pid 10529, fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 1 active children, 0 spare children
[09-Feb-2014 21:30:33.795326] DEBUG: pid 10529, fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 1 active children, 0 spare children
[09-Feb-2014 21:30:42.126558] WARNING: pid 10529, fpm_request_check_timed_out(), line 271: [pool www] child 10530, script '/proj/manager/ssl-server/RPRCP/queues.php' (request: "GET /RPRCP/queues.php") executing too slow (10.179030 sec), logging
[09-Feb-2014 21:30:42.126626] DEBUG: pid 10529, fpm_got_signal(), line 72: received SIGCHLD
[09-Feb-2014 21:30:42.126640] NOTICE: pid 10529, fpm_children_bury(), line 227: child 10530 stopped for tracing
[09-Feb-2014 21:30:42.126647] NOTICE: pid 10529, fpm_php_trace(), line 142: about to trace 10530
[09-Feb-2014 21:30:42.126773] NOTICE: pid 10529, fpm_php_trace(), line 170: finished trace of 10530
[09-Feb-2014 21:30:42.126787] DEBUG: pid 10529, fpm_event_loop(), line 409: event module triggered 1 events
[09-Feb-2014 21:30:42.802499] DEBUG: pid 10529, fpm_pctl_perform_idle_server_maintenance(), line 362: [pool www] currently 1 active children, 0 spare children

很可能工人挂在'_php_stream_get_line'。但为什么它在SIGCHLD之后还活着?

此外我找不到'慢'日志..我在配置中有跟随状态:

prefix = /var/log  
slowlog = /php5-fpm.log.slow  
request_slowlog_timeout = 10s

修改: 我的远程进程被互斥锁僵住了。但为什么php行为如此危险?

0 个答案:

没有答案