Closed minr closed 6 years ago
根据官方文档中reload 会使 onWorkerStart 和 onReceive 中所include的文件重新加载,
但是实际上,如果worker_num数设置过大时,onWorkerStart 和 onReceive 中所included的文件无法被成功重新加载
配置如下:
open_cpu_affinity = 1 process_name = Adms open_tcp_nodelay = 1 daemonize = 1 worker_num = 512 dispatch_mode = 3
swoole 版本如下:
swoole swoole support => enabled Version => 1.9.21 Author => tianfeng.han[email: mikan.tenny@gmail.com] epoll => enabled eventfd => enabled timerfd => enabled signalfd => enabled cpu affinity => enabled spinlock => enabled rwlock => enabled async http/websocket client => enabled Linux Native AIO => enabled pcre => enabled zlib => enabled mutex_timedlock => enabled pthread_barrier => enabled futex => enabled Directive => Local Value => Master Value swoole.aio_thread_num => 2 => 2 swoole.display_errors => On => On swoole.use_namespace => Off => Off swoole.fast_serialize => Off => Off swoole.unixsock_buffer_size => 8388608 => 8388608
PHP扩展如下:
[PHP Modules] amqp apc apcu bcmath bz2 calendar cassandra Core ctype curl date dba dom ereg exif fileinfo filter ftp gd gearman gettext gmp hash iconv intl json libxml mbstring mcrypt mhash mongodb msgpack mysql mysqli mysqlnd nats openssl pcntl pcre PDO pdo_mysql pdo_pgsql pdo_sqlite pgsql Phar posix protobuf qconf readline redis Reflection session shmop SimpleXML soap sockets SPL sqlite3 standard swoole sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache
reload使用的是 shell 命令:
kill -USR1 111
如果将worker_num调低到256以下那么将会被正确重新加载。
因为使用opcache,所以在onWorkerStart 中,opcache_reset 来清理cache。
已上是必现。
可能是opcache的BUG,请检查 onWorkerStart 是否正常执行。
opcache
BUG
onWorkerStart
@matyhtf onWorkerStart 能够正常执行的。。。
那说明swoole底层的reload机制是生效的,可能是由于opcache的一些机制导致。请检查相关配置选项。
swoole
reload
根据官方文档中reload 会使 onWorkerStart 和 onReceive 中所include的文件重新加载,
但是实际上,如果worker_num数设置过大时,onWorkerStart 和 onReceive 中所included的文件无法被成功重新加载
配置如下:
swoole 版本如下:
PHP扩展如下:
reload使用的是 shell 命令:
如果将worker_num调低到256以下那么将会被正确重新加载。
因为使用opcache,所以在onWorkerStart 中,opcache_reset 来清理cache。
已上是必现。