Uploaded image for project: 'translate5'
  1. translate5
  2. TRANSLATE-961

DB Deadlock on session garbage cleaning

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      Problem

      The server produces an FATAL ERROR on session garbage cleanup. The detailed message see at the bottom.

      Result to the user

      Unpredictable.

      1. If the error happens in the garbage collector of the session resource plugin, the user gets probably a white page
      2. If the error happens in the system gc, I assume that the user does not notice anything
        • Additionally it depends on the triggered URL, in the attached error a plugin image was requested through the plugin image proxy. So it is possible that just this image was not delivered to the browser.

      Reason

      The session garbage collection is triggered to often.

      1. It is triggered by the system through the system gc configured in the Session Resource plugin by coupling a Zend_Session_SaveHandler_DbTable instance to the session handlers.
      2. by a explicit call in the Session Resource Plugins init method on each request to the application

      Solution

      All session clean up should be done in a cron job, as it is advised also by the PHP Manual (http://php.net/manual/de/function.session-gc.php):

      Probability based GC works somewhat but it has few problems. 1) Low traffic site's session data may not be deleted within preferred duration. 2) High traffic site's may have too frequent GC. 3) GC is performed on the user's request and the user will experience GC delay.

      Therefore, it is recommended to execute GC periodically for production systems. e.g. Use "cron" for UNIX like systems. Make sure to disable probability based GC by setting session.gc_probability to 0.

      Produced error

      ZfExtended_Log on www.translate5.net - FATAL ERROR

      Given Fatal Error Info: Array
      (
      [type] => 1
      [message] => Uncaught exception 'PDOException' with message 'SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction' in /webs/includes/ZendFramework-1.12.9-minimal/library/Zend/Db/Statement/Pdo.php:228
      Stack trace:
      #0 /webs/includes/ZendFramework-1.12.9-minimal/library/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
      #1 /webs/includes/ZendFramework-1.12.9-minimal/library/Zend/Db/Statement.php(303): Zend_Db_Statement_Pdo->_execute(Array)
      #2 /webs/includes/ZendFramework-1.12.9-minimal/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
      #3 /webs/includes/ZendFramework-1.12.9-minimal/library/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('DELETE FROM `se...', Array)
      #4 /webs/includes/ZendFramework-1.12.9-minimal/library/Zend/Db/Adapter/Abstract.php(664): Zend_Db_Adapter_Pdo_Abstract->query('DELETE FROM `se...')
      #5 /webs/includes/ZendFramework-1.12.9-minimal/library/Zend/Db/Table/Abstract.php(1201): Zend_Db_Ada
      [file] => /webs/includes/ZendFramework-1.12.9-minimal/library/Zend/Db/Statement/Pdo.php
      [line] => 235
      )

      Server Data: Array
      (
      [REDIRECT_HTTPS] => on
      [REDIRECT_SSL_TLS_SNI] => www.translate5.net
      [REDIRECT_STATUS] => 200
      [HTTPS] => on
      [SSL_TLS_SNI] => www.translate5.net
      [HTTP_HOST] => www.translate5.net
      [HTTP_USER_AGENT] => XXXX
      [HTTP_ACCEPT] => /
      [HTTP_ACCEPT_LANGUAGE] => de,en-US;q=0.7,en;q=0.3
      [HTTP_ACCEPT_ENCODING] => gzip, deflate, br
      [HTTP_REFERER] => https://www.translate5.net/editor/plugins/resources/matchResource/plugin.css
      [HTTP_COOKIE] => zfExtended=XXXX
      [HTTP_CONNECTION] => keep-alive
      [HTTP_CACHE_CONTROL] => max-age=0
      [PATH] => /sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
      [SERVER_SIGNATURE] => <address>Apache/2.2.15 (CentOS) Server at www.translate5.net Port 443</address>

      [SERVER_SOFTWARE] => Apache/2.2.15 (CentOS)
      [SERVER_NAME] => www.translate5.net
      [SERVER_ADDR] => XXXX
      [SERVER_PORT] => 443
      [REMOTE_ADDR] => XXXX
      [DOCUMENT_ROOT] => /webs/www.translate5.net/public
      [SERVER_ADMIN] => root@localhost
      [SCRIPT_FILENAME] => /webs/www.translate5.net/public/index.php
      [REMOTE_PORT] => 50588
      [REDIRECT_URL] => /editor/plugins/resources/matchResource/images/share.png
      [GATEWAY_INTERFACE] => CGI/1.1
      [SERVER_PROTOCOL] => HTTP/1.1
      [REQUEST_METHOD] => GET
      [QUERY_STRING] =>
      [REQUEST_URI] => /editor/plugins/resources/matchResource/images/share.png
      [SCRIPT_NAME] => /index.php
      [PHP_SELF] => /index.php
      [REQUEST_TIME_FLOAT] => 1501761783.81
      [REQUEST_TIME] => 1501761783
      )

      Attachments

        Issue Links

          Activity

            People

              tlauria Thomas Lauria
              tlauria Thomas Lauria
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: