swoole (ERRNO 9012): worker exit timeout, forced to terminate

swoole server下使用了swoole_event_add,在关闭服务的时候日志中出现了提示

swWorker_reactor_is_empty (ERRNO 9012): worker exit timeout, forced to terminate

并且关闭服务时间比正常情况下要慢。

解决方法

  1. 开启 'reload_async' => true 配置
  2. 注册onWorderExit回调,在回调中删除事件
    public function onWorkerExit(Server $server, int $worker_id)
    {
        Timer::clearAll();
        swoole_event_del($this->process->pipe);
    }

问题解决

swoole版本4.4.5,php7.2.19

swoole

Swoole => enabled
Author => Swoole Team 
Version => 4.4.5
Built => Sep  9 2019 11:08:20
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.0.2k-fips  26 Jan 2017
http2 => enabled
pcre => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

你可能感兴趣的:(swoole,php)