Please answer these questions before submitting your issue. Thanks!
What did you do? If possible, provide a simple script for reproducing the error.
在woker里面使用了tick
$this->server->on( 'WorkerStart', function( $serv, $worker_id ){
$serv->tick( 1000, function() use ( $serv ){
}
});
What did you expect to see?
退出程序的时候出现
INFO Server is shutdown now
然后一分多钟后才退出退出,会出现
WARNING swWorker_reactor_is_empty (ERRNO 9012): worker exit timeout, forced to terminate
移除tick之后不会出现
通过在tick函数里面增加清除timer的操作就可以解决
$serv->tick( 1000, function() use ( $serv ){
\Swoole\Timer::clearAll();
});
在worker stop之后,定时器还是继续在工作,并没有停止
这个问题之前提了两个issue了
https://github.com/swoole/swoole-src/issues/2686
https://github.com/swoole/swoole-src/issues/2697
What did you see instead?
What version of Swoole are you using (show your php --ri swoole)?
swoole
Swoole => enabled
Author => Swoole Team
Version => 4.4.4
Built => Aug 19 2019 10:19:55
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
http2 => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => 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
What is your machine environment used (including version of kernel & php & gcc) ?
# php -v
PHP 7.3.8 (cli) (built: Aug 2 2019 06:05:30) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
# uname -a
Linux 4aa839b14ac0 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64 Linux
# gcc --version
gcc (Alpine 8.3.0) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.