BusinessWorker打满cpu,出现大量的epoll_wait,是什么原因呢

gc_mike

cpu打满,用strace追进程显示大量的epoll_wait,如下:

epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
epoll_wait(3, {{EPOLLOUT, {u32=13, u64=13}}, {EPOLLOUT, {u32=14, u64=14}}}, 32, -1) = 2
使用lsof查看如下:
php     44438 root    0u      CHR     136,2       0t0         5 /dev/pts/2 (deleted)
php     44438 root    1w      REG     253,1  99381550    131091 /home/wwwlogs/game_access_log/output.log
php     44438 root    2w      REG     253,1  99381550    131091 /home/wwwlogs/game_access_log/output.log
php     44438 root    3u  a_inode       0,9         0      5833 
php     44438 root    4r     FIFO       0,8       0t0 468987447 pipe
php     44438 root    5w     FIFO       0,8       0t0 468987447 pipe
php     44438 root    6u     IPv4 468987448       0t0       TCP localhost:44329->localhost:dc (ESTABLISHED)
php     44438 root    7u     IPv4 468987449       0t0       TCP localhost:imprs->localhost:29700 (ESTABLISHED)
php     44438 root    8u     IPv4 468987450       0t0       TCP localhost:54917->localhost:29701 (ESTABLISHED)
php     44438 root    9u     IPv4 468987451       0t0       TCP localhost:9610->localhost:29703 (ESTABLISHED)
php     44438 root   10u     IPv4 468987452       0t0       TCP localhost:52219->localhost:29702 (ESTABLISHED)
php     44438 root   11u     IPv4 468989939       0t0       TCP localhost:57926->localhost:11210 (ESTABLISHED)
php     44438 root   12u     IPv4 470778153       0t0       TCP localhost:21543->localhost:mysql (ESTABLISHED)
php     44438 root   13u     IPv4 469339300       0t0       TCP yqgame:30110->www.jump.com:29000 (CLOSE_WAIT)
php     44438 root   14u     IPv4 469356292       0t0       TCP yqgame:31576-

workerman status状态如下:

负载:43.77
Workerman version:3.5.14          PHP version:7.0.22
start time:2018-08-29 15:14:19   run 6 days 21 hours
load average: 43.77, 44, 44      event-loop:\Workerman\Events\Event
5 workers       69 processes
worker_name          exit_status      exit_count
GameBusinessWorker   0                204
GoldCoinMatchService 0                52
FileMonitor          0                0
GameServerGateway    0                0
Register             0                0
5291 1 0
1个回答

walkor 打赏

看下是不是哪里设置了set_error_hanlder

  • gc_mike 2018-09-05

    set_error_hanlder 只有monolog和phpredis存在,和这个有什么关系吗

  • walkor 2018-09-05

    目前已知的问题是代码里设置了 set_error_hanlder,并且在warning notice等出现时会进入set_error_hanlder设定的函数,如果函数里抛出异常,会导致event扩展行为异常,就是不断的触发epoll_wait,但是不会执行epoll_wait对应的回调

年代过于久远,无法发表回答
×
🔝