We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如下面报错,其实不用特别的高并发,用workerman开4个进程,如果有频繁的模型save,没有开启数据库字段缓存,就会频繁出现下面的报错。
TypeError: think\cache\driver\Redis::getTagItems(): Return value must be of type array, bool returned in /home/augushong/www/ulthon_admin/vendor/topthink/framework/src/think/cache/driver/Redis.php:233 Stack trace: #0 /home/augushong/www/ulthon_admin/vendor/topthink/framework/src/think/cache/TagSet.php(112): think\cache\driver\Redis->getTagItems() #1 /home/augushong/www/ulthon_admin/vendor/topthink/think-orm/src/db/PDOConnection.php(877): think\cache\TagSet->clear() #2 /home/augushong/www/ulthon_admin/vendor/topthink/think-orm/src/db/PDOConnection.php(1167): think\db\PDOConnection->pdoExecute() #3 /home/augushong/www/ulthon_admin/vendor/topthink/think-orm/src/db/BaseQuery.php(1260): think\db\PDOConnection->update() #4 /home/augushong/www/ulthon_admin/vendor/topthink/think-orm/src/Model.php(673): think\db\BaseQuery->update() #5 /home/augushong/www/ulthon_admin/vendor/topthink/think-orm/src/db/PDOConnection.php(1521): think\Model->think\{closure}() #6 /home/augushong/www/ulthon_admin/vendor/topthink/think-orm/src/db/concern/Transaction.php(47): think\db\PDOConnection->transaction() #7 /home/augushong/www/ulthon_admin/vendor/topthink/think-orm/src/Model.php(665): think\db\BaseQuery->transaction() #8 /home/augushong/www/ulthon_admin/vendor/topthink/think-orm/src/Model.php(564): think\Model->updateData() #9 /home/augushong/www/ulthon_admin/app/worker/net/worker/start.php(86): think\Model->save() #10 /home/augushong/www/ulthon_admin/vendor/workerman/workerman/Events/Event.php(167): app\common\console\WorkerCommandConsole->{closure}() #11 [internal function]: Workerman\Events\Event->timerCallback() #12 /home/augushong/www/ulthon_admin/vendor/workerman/workerman/Events/Event.php(193): EventBase->loop() #13 /home/augushong/www/ulthon_admin/vendor/workerman/workerman/Worker.php(1635): Workerman\Events\Event->loop() #14 /home/augushong/www/ulthon_admin/vendor/workerman/workerman/Worker.php(1426): Workerman\Worker::forkOneWorkerForLinux() #15 /home/augushong/www/ulthon_admin/vendor/workerman/workerman/Worker.php(1400): Workerman\Worker::forkWorkersForLinux() #16 /home/augushong/www/ulthon_admin/vendor/workerman/workerman/Worker.php(1785): Workerman\Worker::forkWorkers() #17 /home/augushong/www/ulthon_admin/vendor/workerman/workerman/Worker.php(1721): Workerman\Worker::monitorWorkersForLinux() #18 /home/augushong/www/ulthon_admin/vendor/workerman/workerman/Worker.php(562): Workerman\Worker::monitorWorkers() #19 /home/augushong/www/ulthon_admin/app/common/console/WorkerCommandConsole.php(84): Workerman\Worker::runAll() #20 /home/augushong/www/ulthon_admin/app/common/command/fusion/NetWorker.php(35): app\common\console\WorkerCommandConsole->execute() #21 /home/augushong/www/ulthon_admin/vendor/topthink/framework/src/think/console/Command.php(210): app\common\command\fusion\NetWorker->execute() #22 /home/augushong/www/ulthon_admin/vendor/topthink/framework/src/think/Console.php(649): think\console\Command->run() #23 /home/augushong/www/ulthon_admin/vendor/topthink/framework/src/think/Console.php(308): think\Console->doRunCommand() #24 /home/augushong/www/ulthon_admin/vendor/topthink/framework/src/think/Console.php(245): think\Console->doRun() #25 /home/augushong/www/ulthon_admin/think(12): think\Console->run() #26 {main}
The text was updated successfully, but these errors were encountered:
有点奇怪,按照 phpredis 的文档,返回类型应该只有 array,不应该返回 bool
array
bool
Sorry, something went wrong.
我也遇到过这个问题 经过调试发现问题出在vendor\topthink\framework\src\think\cache\driver\Redis.php. 不同进程用同一个hander就会出现, 所以临时修改增加 static protected array $instance = []; //redis实例化时静态变量,防止fork多进程后数据污染
这么长时间了,再补充一下吧,当时也怀疑过时多个进程使用同一个资源造成的,所以的当时的操作是调用Cache::forgetDriver();
Cache::forgetDriver();
但我在新建进程中forgetDriver,不是为了解决标题的这个问题。复制进程后就需要清空,否则确实会出问题。至于字段这个问题,没有深度排查,只是开启了字段缓存。
No branches or pull requests
如下面报错,其实不用特别的高并发,用workerman开4个进程,如果有频繁的模型save,没有开启数据库字段缓存,就会频繁出现下面的报错。
The text was updated successfully, but these errors were encountered: