top-think / think-swoole

Swoole extend for thinkphp
Apache License 2.0
457 stars 105 forks source link

默认开启了cache连接池,在websokcet的event handle中使用redis的时候仍然报错 #152

Closed HyperLife1119 closed 4 years ago

HyperLife1119 commented 4 years ago

报错如下:

PHP Fatal error:  Uncaught Swoole\Error: Socket#15 has already been bound to another coroutine#135, reading of the same socket in coroutine#136 at the same time is not allowed in /www/wwwroot/xxxxx/vendor/topthink/framework/src/think/cache/driver/Redis.php:116
Stack trace:
#0 /www/wwwroot/xxxxx/vendor/topthink/framework/src/think/cache/driver/Redis.php(116): Redis->get()
#1 /www/wwwroot/xxxxx/vendor/topthink/framework/src/think/session/driver/Cache.php(38): think\cache\driver\Redis->get()
#2 /www/wwwroot/xxxxx/vendor/topthink/framework/src/think/session/Store.php(83): think\session\driver\Cache->read()
#3 /www/wwwroot/xxxxx/vendor/topthink/framework/src/think/Manager.php(174): think\session\Store->init()
#4 [internal function]: think\Manager->__call()
#5 /www/wwwroot/xxxxx/vendor/topthink/framework/src/think/Facade.php(96): call_user_func_array()
#6 /www/wwwroot/xxxxx/app/websocket/Handler.php(58): think\Facade::__callStati in /www/wwwroot/xxxxx/vendor/topthink/framework/src/think/cache/driver/Redis.php on line 116

我使用的是 Cache::store('redis')->handler() 来获取redis实例 查阅了一下swoole的文档,说要用连接池,但我已经开启了cache连接池,仍然出现该问题

跟这个问题类似,只不过我的问题是redis https://github.com/top-think/think-swoole/issues/134

HyperLife1119 commented 4 years ago

我使用的think-swoole版本是目前最新稳定版