Skip to content
New issue

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

Redis error: ERR wrong number of arguments for 'set' command #78

Closed
smudliyar opened this issue Aug 11, 2016 · 4 comments
Closed

Redis error: ERR wrong number of arguments for 'set' command #78

smudliyar opened this issue Aug 11, 2016 · 4 comments

Comments

@smudliyar
Copy link

smudliyar commented Aug 11, 2016

Page caching is working in redis version

=> Redis server v=2.8.4 sha=00000000:0 malloc=jemalloc-3.4.1 bits=64 build=a44a05d76f06a5d9
=> yii 2.0.7 | PHP 5.5.9-1 | ubuntu4.17

But its not working in below version

=>Redis server v=3.2.1 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=4088abd4b3d654a1
=> yii 2.0.7 | PHP 5.5.37 (cli) | CentOS release 6.8 (Final)

Showing following error

An Error occurred while handling another error:
exception 'yii\base\InvalidCallException' with message 'Unexpected yii\widgets\FragmentCache::end() call. A matching begin() is not found.' in /home/public_html/vendor/yiisoft/yii2/base/Widget.php:83
Stack trace:
#0 /home/public_html/vendor/yiisoft/yii2/base/View.php(475): yii\base\Widget::end()
#1 /home/public_html/vendor/yiisoft/yii2/filters/PageCache.php(214): yii\base\View->endCache()
#2 [internal function]: yii\filters\PageCache->cacheResponse(Object(yii\base\Event))
#3 /home/public_html/vendor/yiisoft/yii2/base/Component.php(541): call_user_func(Array, Object(yii\base\Event))
#4 /home/public_html/vendor/yiisoft/yii2/web/Response.php(316): yii\base\Component->trigger('afterSend')
#5 /home/public_html/vendor/yiisoft/yii2/web/ErrorHandler.php(126): yii\web\Response->send()
#6 /home/public_html/vendor/yiisoft/yii2/base/ErrorHandler.php(109): yii\web\ErrorHandler->renderException(Object(yii\db\Exception))
#7 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\db\Exception))
#8 {main}

Previous exception:
exception 'yii\db\Exception' with message 'Redis error: ERR wrong number of arguments for 'set' command
`Redis command was: SET 106673edd0deebb81340fa78d36776db a:2:{i:0;a:2:{i:0;s:18723:"

<title>Order Services</title> ..................................... ................................. });</script> ";i:1;N;}i:1;N;} PX 86400000' in /home/public_html/vendor/yiisoft/yii2-redis/Connection.php:417`
@cebe
Copy link
Member

cebe commented Aug 12, 2016

The error message is not related to redis. It tells you that you are calling yii\widgets\FragmentCache::end() but have not called yii\widgets\FragmentCache::begin() before in your code.

@cebe cebe closed this as completed Aug 12, 2016
@smudliyar
Copy link
Author

smudliyar commented Aug 12, 2016

@cebe as i said in my comment it was working in following setup
=> Redis server v=2.8.4 sha=00000000:0 malloc=jemalloc-3.4.1 bits=64 build=a44a05d76f06a5d9
=> yii 2.0.7 | PHP 5.5.9-1 | ubuntu4.17

But not working in
=>Redis server v=3.2.1 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=4088abd4b3d654a1
=> yii 2.0.7 | PHP 5.5.37 (cli) | CentOS release 6.8 (Final)

And i have investigated y this weird behavior, then i come to know certain issue in yii2-redis/cache.php in following code
protected function setValue($key, $value, $expire) { if ($expire == 0) { return (bool) $this->redis->executeCommand('SET', [$key, $value]); } else { $expire = (int) ($expire * 1000); return (bool) $this->redis->executeCommand('SET', [$key, $value, 'PX', $expire]); } }

When i add $expire then it give me that error which i posted here

@glebmachine
Copy link

Got same error

@cebe cebe reopened this Mar 5, 2017
@glebmachine
Copy link

No no no!
i've found that my redis was outdated, i'm sorry!

@cebe cebe closed this as completed Mar 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants