我有一个 CentOS 6.3 下的 Drupal 网络服务器 vps,自二月份以来一直运行良好。
在过去的几天里,该网站开始出现故障:tcp 连接,然后无限期等待。
如果我重新启动 httpd,该网站将恢复响应几分钟,然后再次停止运行。
磁盘空间充足,CPU 空闲,大约一半的系统内存用于缓冲区和缓存。Mysqld 保持响应。
如果我在 httpd 工作进程上运行 pstack,它们似乎会卡在同一个位置:
#0 0x00007f568d9c3a28 in poll () from /lib64/libc.so.6
#1 0x00007f568deb6717 in apr_wait_for_io_or_timeout () from /usr/lib64/libapr-1.so.0
#2 0x00007f568deb1a28 in apr_socket_sendv () from /usr/lib64/libapr-1.so.0
#3 0x00007f568f3d3083 in ?? ()
#4 0x00007f568f3d4035 in ap_core_output_filter ()
#5 0x00007f568f3e6194 in ap_http_chunk_filter ()
#6 0x00007f568f3e46db in ap_http_header_filter ()
#7 0x00007f568f3c8fd0 in ap_content_length_filter ()
#8 0x00007f568f3e6443 in ap_byterange_filter ()
#9 0x00007f568f3df9fc in ap_filter_flush ()
#10 0x00007f568f3c6f8e in ap_rwrite ()
#11 0x00007f5689814f76 in ?? () from /etc/httpd/modules/libphp5.so
#12 0x00007f568974e36b in php_ub_body_write_no_header () from /etc/httpd/modules/libphp5.so
#13 0x00007f568974e998 in php_end_ob_buffer () from /etc/httpd/modules/libphp5.so
#14 0x00007f568974f32f in ?? () from /etc/httpd/modules/libphp5.so
#15 0x00007f568974e998 in php_end_ob_buffer () from /etc/httpd/modules/libphp5.so
#16 0x00007f568974f051 in ?? () from /etc/httpd/modules/libphp5.so
#17 0x00007f56897db0c8 in ?? () from /etc/httpd/modules/libphp5.so
#18 0x00007f56897b2400 in execute () from /etc/httpd/modules/libphp5.so
#19 0x00007f568978cb3d in zend_execute_scripts () from /etc/httpd/modules/libphp5.so
#20 0x00007f568973ada8 in php_execute_script () from /etc/httpd/modules/libphp5.so
#21 0x00007f5689815a85 in ?? () from /etc/httpd/modules/libphp5.so
#22 0x00007f568f3d4b00 in ap_run_handler ()
#23 0x00007f568f3d83be in ap_invoke_handler ()
#24 0x00007f568f3e386c in ap_internal_redirect ()
#25 0x00007f568b82a7a5 in ?? () from /etc/httpd/modules/mod_rewrite.so
#26 0x00007f568f3d4b00 in ap_run_handler ()
#27 0x00007f568f3d83be in ap_invoke_handler ()
#28 0x00007f568f3e3a30 in ap_process_request ()
#29 0x00007f568f3e08f8 in ?? ()
#30 0x00007f568f3dc608 in ap_run_process_connection ()
#31 0x00007f568f3e8807 in ?? ()
#32 0x00007f568f3e8b1a in ?? ()
#33 0x00007f568f3e979c in ap_mpm_run ()
#34 0x00007f568f3c0900 in main ()
有什么建议下一步该如何调试吗?
答案1
尝试运行strace -p PID_OF_APACHE -f
以调试输出。此外,也许您需要更新 Apache 版本和/或其一个或多个依赖项 - 或者甚至 Drupal(如果尚未更新)。
您可能需要检查上述服务的更改日志,看看是否存在任何已知问题。
答案2
堆栈跟踪显示 php 正在刷新输出缓冲区,并等待浏览器响应。
您应该进行网络跟踪,看看来自某些客户端的流量是否不切实际地慢。这可能是懒猴攻击。