yiisoft / yii2-redis

Yii 2 Redis extension.
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
452 stars 183 forks source link

Exception after configuration: 'socketClientFlags' => STREAM_CLIENT_PERSISTENT #245

Closed 7937505 closed 2 years ago

7937505 commented 2 years ago

name "Redis Socket Exception" message "Failed to write to socket. 0 of 23 bytes written.\nRedis command was: 2\r\n$6\r\nSELECT\r\n$1\r\n7\r\n" code "" type "yii\redis\SocketException" file "/vendor/yiisoft/yii2-redis/src/Connection.php" line 827 stack-trace 0 "#0 /vendor/yiisoft/yii2-redis/src/Connection.php(796): yii\redis\Connection->sendRawCommand('2\r\n$6\r\nSELECT\r...', Array)" 1 "#1 /vendor/yiisoft/yii2-redis/src/Connection.php(652): yii\redis\Connection->executeCommand('SELECT', Array)" 2 "#2 /vendor/yiisoft/yii2-redis/src/Connection.php(759): yii\redis\Connection->open()" 3 "#3 /vendor/yiisoft/yii2-redis/src/Cache.php(198): yii\redis\Connection->executeCommand('GET', Array)" 4 "#4 /vendor/yiisoft/yii2/caching/Cache.php(134): yii\redis\Cache->getValue('8301292eb993d3f...')" 5 "#5 /vendor/yiisoft/yii2/web/UrlManager.php(311): yii\caching\Cache->get('8301292eb993d3f...')" 6 "#6 /vendor/yiisoft/yii2/web/UrlManager.php(229): yii\web\UrlManager->getBuiltRulesFromCache(Array)" 7 "#7 /vendor/yiisoft/yii2/web/UrlManager.php(211): yii\web\UrlManager->buildRules(Array)" 8 "#8 /vendor/yiisoft/yii2-debug/src/Module.php(293): yii\web\UrlManager->addRules(Array, false)" 9 "#9 /vendor/yiisoft/yii2/base/Application.php(325): yii\debug\Module->bootstrap(Object(yii\web\Application))" 10 "#10 /vendor/yiisoft/yii2/web/Application.php(69): yii\base\Application->bootstrap()" 11 "#11 /vendor/yiisoft/yii2/base/Application.php(271): yii\web\Application->bootstrap()" 12 "#12 /vendor/yiisoft/yii2/base/BaseObject.php(109): yii\base\Application->init()" 13 "#13 /vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->construct(Array)" 14 "#14 /public/web/index.php(20): yii\base\Application->construct(Array)" 15 "#15 {main}"

Additional info

Q A
Yii vesion 2.0.45
PHP version 8.0
Operating system debian 10
yii-bot commented 2 years ago

Thanks for posting in our issue tracker. In order to properly assist you, we need additional information:

Thanks!

This is an automated comment, triggered by adding the label status:need more info.

7937505 commented 2 years ago

'class' => 'yii\redis\Connection', 'hostname' => '10.0.4.7', 'port' => 6379, 'database' => 7, 'socketClientFlags' => STREAM_CLIENT_PERSISTENT,

When I increased the socketClientFlags setting, the exception appeared

runtu666 commented 1 month ago

I have the same problem ,Has this been solved? How?

runtu666 commented 1 month ago

@7937505

runtu666 commented 1 month ago

@samdark the same issue https://github.com/yiisoft/yii2-queue/issues/390 . Has this been solved too?

samdark commented 1 month ago

I think so. It's closed.

runtu666 commented 1 month ago

@samdark But I have the same problem. After I add <'socketClientFlags' => STREAM_CLIENT_PERSISTENT,>
<Failed to write to socket> will appear.

particleflux commented 2 weeks ago

You can't use STREAM_CLIENT_PERSISTENT standalone, needs to be STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, it's a bit mask

runtu666 commented 2 weeks ago

@particleflux yes , it is STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT , but get error