Debian VPS上的Apache服务器有问题。 经过一段时间(几个小时)的工作,它冻结,没有请求正在处理(服务器允许连接,但没有返回)。
# apache2 -v Server version: Apache/2.2.22 (Debian) Server built: Dec 23 2014 22:48:29 # apache2 -l Compiled in modules: core.c mod_log_config.c mod_logio.c mod_version.c prefork.c http_core.c mod_so.c <IfModule mpm_prefork_module> StartServers 1 MinSpareServers 1 MaxSpareServers 19 MaxClients 19 MaxRequestsPerChild 20 </IfModule>
这个configuration是经过一些testing后,MaxRequestsPerChild似乎有所帮助,但是没有,服务器仍然是frezees。
当服务器被冻结时,它停留在poll系统调用:
# strace -p 30145 Process 30145 attached - interrupt to quit restart_syscall(<... resuming interrupted call ...>) = 0 poll([{fd=25, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout) poll([{fd=25, events=POLLIN|POLLERR|POLLHUP}], 1, 10000 [......]
这继续下去。 gdb的这个回溯结果:
#0 0x00007eff42499d13 in poll () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007eff3f35bf50 in ?? () from /usr/lib/apache2/modules/libphp5.so #2 0x00007eff3f16a5b2 in ?? () from /usr/lib/apache2/modules/libphp5.so #3 0x00007eff3f34fa65 in _php_stream_fill_read_buffer () from /usr/lib/apache2/modules/libphp5.so #4 0x00007eff3f34fba7 in _php_stream_read () from /usr/lib/apache2/modules/libphp5.so #5 0x00007eff3f2cc14a in zif_fread () from /usr/lib/apache2/modules/libphp5.so #6 0x00007eff3f4411c1 in ?? () from /usr/lib/apache2/modules/libphp5.so #7 0x00007eff3f3fab77 in execute () from /usr/lib/apache2/modules/libphp5.so #8 0x00007eff3f399a1c in zend_execute_scripts () from /usr/lib/apache2/modules/libphp5.so #9 0x00007eff3f339393 in php_execute_script () from /usr/lib/apache2/modules/libphp5.so #10 0x00007eff3f4438ba in ?? () from /usr/lib/apache2/modules/libphp5.so #11 0x00007eff4326bdc0 in ap_run_handler () #12 0x00007eff4326c20b in ap_invoke_handler () #13 0x00007eff4327c448 in ap_process_request () #14 0x00007eff432792c8 in ?? () #15 0x00007eff43272780 in ap_run_process_connection () #16 0x00007eff432811ee in ?? () #17 0x00007eff43281942 in ?? () #18 0x00007eff432824a6 in ap_mpm_run () #19 0x00007eff432568e6 in main ()
所以它看起来它卡在PHP中:
# php -v PHP 5.4.36-0+deb7u3 (cli) (built: Jan 9 2015 08:07:06) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
任何提示是怎么回事? configuration和代码基本上没有变化,只有更新包和WordPress的应用(本网站运行几个小的Wordpress实例和静态网站。内存使用量约为800 MB时,VPS是1G的内存。