环境:Ubuntu 10.04 LTS,Passenger,Nginx 1.0.6,MySQL,Ruby 1.9.2,Rails 3.1
经过一段时间之后,服务器的CPU数量将会逐渐增加,而CPU数量将会逐渐增加
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2393 avitus 20 0 496m 381m 1392 R 100 9.4 25:10.74 Rack: /home/web ...
对任何卡住的PID运行strace给出以下内容:
Process 2393 attached with 3 threads - interrupt to quit [pid 2396] futex(0x8ca80e4, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...> [pid 2394] restart_syscall(<... resuming interrupted call ...>) = -1 ETIMEDOUT (Connection timed out) [pid 2394] gettimeofday({1322590778, 346573}, NULL) = 0 [pid 2394] futex(0x821db60, FUTEX_WAKE_PRIVATE, 1) = 0 [pid 2394] clock_gettime(CLOCK_REALTIME, {1322590778, 346885177}) = 0 [pid 2394] futex(0x821db84, FUTEX_WAIT_PRIVATE, 33872659, {0, 9687823}) = -1 ETIMEDOUT (Connection timed out) [pid 2394] gettimeofday({1322590778, 356921}, NULL) = 0 [pid 2394] futex(0x821db60, FUTEX_WAKE_PRIVATE, 1) = 0 [pid 2394] clock_gettime(CLOCK_REALTIME, {1322590778, 357196244}) = 0 [pid 2394] futex(0x821db84, FUTEX_WAIT_PRIVATE, 33872661, {0, 9724756}) = -1 ETIMEDOUT (Connection timed out) [pid 2394] gettimeofday({1322590778, 367240}, NULL) = 0 [pid 2394] futex(0x821db60, FUTEX_WAKE_PRIVATE, 1) = 0 [pid 2394] clock_gettime(CLOCK_REALTIME, {1322590778, 367459723}) = 0 [pid 2394] futex(0x821db84, FUTEX_WAIT_PRIVATE, 33872663, {0, 9780277}) = -1 ETIMEDOUT (Connection timed out) [pid 2394] gettimeofday({1322590778, 377586}, NULL) = 0 [pid 2394] futex(0x821db60, FUTEX_WAKE_PRIVATE, 1) = 0 [pid 2394] clock_gettime(CLOCK_REALTIME, {1322590778, 377807840}) = 0 [pid 2394] futex(0x821db84, FUTEX_WAIT_PRIVATE, 33872665, {0, 9778160}) = -1 ETIMEDOUT (Connection timed out) [pid 2394] gettimeofday({1322590778, 387932}, NULL) = 0 [pid 2394] futex(0x821db60, FUTEX_WAKE_PRIVATE, 1) = 0 [pid 2394] clock_gettime(CLOCK_REALTIME, {1322590778, 388162450}) = 0 [pid 2394] futex(0x821db84, FUTEX_WAIT_PRIVATE, 33872667, {0, 9769550}) = -1 ETIMEDOUT (Connection timed out)
包括strace的'c'标志给出:
Process 2393 attached with 3 threads - interrupt to quit Process 2393 detached Process 2394 detached Process 2396 detached % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 94.97 0.003172 2 1489 744 futex 3.74 0.000125 0 745 clock_gettime 1.29 0.000043 0 745 gettimeofday 0.00 0.000000 0 1 1 restart_syscall ------ ----------- ----------- --------- --------- ---------------- 100.00 0.003340 2980 745 total
我可以杀死-9卡的进程和应用程序和服务器出现进行愉快。 关于如何进行debugging,我已经没有什么想法了,所以如果任何人对调查的原因或其他调查途径有任何的build议,那将是非常棒的。
尝试在乘客中将passenger_spawn_method设置为保守。 我与Mongo有这个问题,碰到:
http://code.google.com/p/phusion-passenger/issues/detail?id=684
和:
https://github.com/rails/rails/issues/1339
我不知道为什么它不工作,但希望如果你还没有find解决scheme,会让你走。
这种特殊的行为(每20毫秒检查一次futex,然后检查一天的时间)似乎是一个闲置的Ruby进程的正常行为:
尝试在您的服务器上运行以下命令
sudo date -s "`date`"
资料来源: http : //www.redmine.org/boards/2/topics/31731