swoole-co-pool icon indicating copy to clipboard operation
swoole-co-pool copied to clipboard

防止stop异常:Call to a member function close() on null

Open Eno-CN opened this issue 1 year ago • 4 comments

Eno-CN avatar Jan 25 '24 02:01 Eno-CN

taskQueue 没有其它地方赋值为null吧?难道是stop()重复调用?

Yurunsoft avatar Jan 25 '24 02:01 Yurunsoft

taskQueue 没有其它地方赋值为null吧?难道是stop()重复调用?

在imi中使用队列消费时,如果stop服务,会出下面的报错

[2024-01-24 17:17:52.735670] system ERROR service-stat Uncaught Error: Call to a member function close() on null in phar:///xxx/test/service-stat.phar/vendor/yurunsoft/swoole-co-pool/src/CoPool.php:132
Stack trace:
#0 phar:///xxx/test/service-stat.phar/vendor/imiphp/imi-queue/src/Partial/SwooleBaseQueueConsumerPartial.php(96): Yurun\Swoole\CoPool\CoPool->stop()
#1 phar:///xxx/test/service-stat.phar/vendor/imiphp/imi-queue/src/Process/SwooleQueueConsumerProcess.php(93): StatOperationDayDimensionConsumer__Bean__44->stop()
#2 phar:///xxx/test/service-stat.phar/vendor/imiphp/imi/src/Event/TEvent.php(202): Imi\Queue\Process\SwooleQueueConsumerProcess->Imi\Queue\Process\{closure}()
#3 phar:///xxx/test/service-stat.phar/vendor/imiphp/imi-swoole/src/Process/Pool.php(288): Imi\Swoole\Process\Pool->trigger()
#4 [internal function]: Imi\Swoole\Process\Pool->Imi\Swoole\Process\{closure}()
#5 {main}
  thrown  

Eno-CN avatar Jan 25 '24 03:01 Eno-CN

有可能是重复执行了 stop(),这个问题我也遇到过,一直无视了停止阶段的报错,可能需要到 imi 里去处理

Yurunsoft avatar Jan 25 '24 03:01 Yurunsoft

/

好的。

Eno-CN avatar Jan 25 '24 03:01 Eno-CN