4

Hi we are seeing some errors in our logs like this. And users are continuously being logged out of the backend. The logging however is nog 1-1 with being logged out. Sometimes we see this in log, sometimes not.

How can I debug all traffic from and to Redis related to session to investigate this issue?

Next exception 'CredisException' with message 'read error on connection' in /.modman/Cm_RedisSession/lib/Credis/Client.php:919 Stack trace: 0 /.modman/Cm_RedisSession/lib/Credis/Client.php(586): Credis_Client->__call('select', Array) 1 /.modman/Cm_RedisSession/code/Model/Session.php(415): Credis_Client->select(2) 2 [internal function]: Cm_RedisSession_Model_Session->write('ec31cf667c0b8f1...', '') 3 /app/code/core/Mage/Core/Model/Resource/Session.php(97): session_write_close() 4 [internal function]: Mage_Core_Model_Resource_Session->__destruct() 5 {main}

2015-01-14T11:05:51+00:00 ERR (3): exception 'RedisException' with message 'read error on connection' in /.modman/Cm_RedisSession/lib/Credis/Client.php:901 Stack trace: 0 [internal function]: Redis->select(2) 1 /.modman/Cm_RedisSession/lib/Credis/Client.php(901): call_user_func_array(Array, Array) 2 /.modman/Cm_RedisSession/lib/Credis/Client.php(586): Credis_Client->__call('select', Array) 3 /.modman/Cm_RedisSession/code/Model/Session.php(415): Credis_Client->select(2) 4 [internal function]: Cm_RedisSession_Model_Session->write('3c0ca6f2d3d4c56...', '') 5 /app/code/core/Mage/Core/Model/Resource/Session.php(97): session_write_close() 6 [internal function]: Mage_Core_Model_Resource_Session->__destruct() 7 {main}

UPDATE (thanks to @Rob).

  • Updated time out to 5 seconds, was 2.5 - we also use
<session_save>db</session_save>
  <redis_session>                                             <!-- All options seen here are the defaults -->
      <host>127.0.0.1</host>                                  <!-- Specify an absolute path if using a unix socket -->
      <port>6380</port>
      <password></password>                                   <!-- Specify if your Redis server requires authentication -->
      <timeout>5</timeout>                                    <!-- This is the Redis connection timeout, not the locking timeout -->
      <persistent></persistent>                               <!-- Specify unique string to enable persistent connections. -->
      <db>2</db>                                              <!-- Redis database number -->
      <compression_threshold>2048</compression_threshold>     <!-- Set to 0 to disable compression -->
      <compression_lib>snappy</compression_lib>                   <!-- gzip, lzf or snappy -->
      <log_level>7</log_level>                                <!-- 0 emergency /4 warning / 5 notice / 6 info -->
      <max_concurrency>10</max_concurrency>                   <!-- maximum procs waiting for lock 10% of the number of PHP processes -->
      <break_after_frontend>5</break_after_frontend>          <!-- seconds to wait for a session lock in the frontend -->
      <break_after_adminhtml>10</break_after_adminhtml>
      <bot_lifetime>7200</bot_lifetime>                    <!-- Bots get shorter session lifetimes. 0 to disable -->
</redis_session>

timeout in /etc/redis/redis.conf

timeout 0

default_socket_timeout in php.ini

; Default timeout for socket based streams (seconds) default_socket_timeout = 60

Executed echo 1 > /proc/sys/vm/overcommit_memory

/proc/sys/vm/overcommit_memory = 1

5

A few things to try:

  1. Make sure persistent redis connections are not enabled. This can cause issues with Magento (check your local.xml file).

  2. In your redis.conf file, make sure the timeout is set to zero "timeout 0".

  3. Check your php.ini to make sure the default socket timeout is not set to some small positive number "default_socket_timeout".

  4. Check the value of "/proc/sys/vm/overcommit_memory" on your server. If it's zero, try upping it to 1. This will allow Redis to commit changes to the disk backup if you're using it even if enough RAM is not present for a full commit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.