Details

      Description

      Hello,

      We have an issue with 2 of our customers in eZ Publish 4.x with Cluster DFS. ( it's still true in 5.x )
      Note that it's very very hard to reproduce excepted in production environment and high traffic.

      We've already detected an issue identified here : https://jira.ez.no/browse/EZP-19688.

      The fact is that we have sometimes some rows in the database with a mtime=0, and eZ believes the viewcache is always good, so a new publication doesn't regenerate the viewcache.

      We've identified the query which is responsible, it is in the _endCacheGeneration method of kernel/private/classes/clusterfilehandlers/dfsbackends/mysqli.php
      https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/private/classes/clusterfilehandlers/dfsbackends/mysqli.php#L1608

      if ( !$this->_query( "UPDATE " . self::TABLE_METADATA . " SET mtime = '{$mtime}', expired = 0, size = '{$filesize}' WHERE name_hash=MD5('$filePath')", $fname, true ) )
      

      mtime and filesize are empty, the trace is :

      UPDATE ezdfsfile SET mtime = '', expired = 0, size = '' WHERE name_hash=MD5('var/plain_site/cache/content/site/2-a54e7f5dba0d9df9de22904d309754b8.cache') - cluster::mysql::_endCacheGeneration( var/plain_site/cache/content/site/2-a54e7f5dba0d9df9de22904d309754b8.cache )[1 rows, 0.001 ms] 
      

      But, theses values come from a previous query, above in the same method :

      if ( !$res = $this->_query( "SELECT * FROM " . self::TABLE_METADATA . " WHERE name_hash=MD5('$generatingFilePath') FOR UPDATE", $fname, true ) )
      {
          $this->_rollback( $fname );
          // @todo Throw an exception
          return false;
      }
      $generatingMetaData = mysqli_fetch_assoc( $res );
      

      I think this query return an empty array (generatingMetaData) in the mysqli_fetch_assoc.

      Then, the code enter in the "else" of this condition :

                  // the original file does not exist: we move the generating file
                  $res = $this->_query( "SELECT * FROM " . self::TABLE_METADATA . " WHERE name_hash=MD5('$filePath') FOR UPDATE", $fname, false );
                  if ( mysqli_num_rows( $res ) == 0 )
      

      And in this "else", we are in the query we've detected.

      UPDATE ezdfsfile SET mtime = '', expired = 0, size = ''
      

      What is the good correction, do we have yo call the rollback ?

      ++

      Note: we already have to solution, I'm going to create the PR and comment this ticket.

        Issue Links

          Activity

          Hide
          Sébastien Morel added a comment - - edited

          here is our fix.
          https://github.com/ezsystems/ezpublish-legacy/pull/935

          @eZ Team : These two clients are under entreprise version, we fixed in production env for 1 or 2 months, a ticket was created and closed http://project.issues.ez.no/12141
          But I don't see the correction in the kernel (maybe it's normal according the code quality process...I don't know) but as I see the 5.3 version arriving, it could be nice to have this fix inside.

          Hope it can help !

          Show
          Sébastien Morel added a comment - - edited here is our fix. https://github.com/ezsystems/ezpublish-legacy/pull/935 @eZ Team : These two clients are under entreprise version, we fixed in production env for 1 or 2 months, a ticket was created and closed http://project.issues.ez.no/12141 But I don't see the correction in the kernel (maybe it's normal according the code quality process...I don't know) but as I see the 5.3 version arriving, it could be nice to have this fix inside. Hope it can help !
          Show
          Damien Pobel (Inactive) added a comment - PR: https://github.com/ezsystems/ezpublish-legacy/pull/935
          Show
          Yannick Roger (Inactive) added a comment - Fixed in master: https://github.com/ezsystems/ezpublish-legacy/commit/7faa31a2735b4ba7220d098592df3e57bd195c17
          Hide
          Joao Pingo (Inactive) added a comment -

          QA approved

          Show
          Joao Pingo (Inactive) added a comment - QA approved

            People

            • Assignee:
              Unassigned
              Reporter:
              Sébastien Morel
            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 1 hour
                2d 1h