Announcement

Collapse
No announcement yet.

Rebuild Database Error: Error while rebuilding database. See log file for details.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rebuild Database Error: Error while rebuilding database. See log file for details.

    I encountered this error while doing a cli rebuild (luckily in a test server) and traced it to the DataManager class (application/Espo/Core/DataManager.php) rebuildDatabase function.

    This function takes an array $entityList as parameter but it is coming with a "null" value (the dafault parameter value) which throws this error. I understand that the $entityList parameter is supposed to be an array with a list of entity names but in this case is not being passed to the DataManager function and I couldn't figure out what class creates and passes this parameter to DataManager.

    Does anyone have any ideas that you could share ?

    I'm about to go for my ultimate solution of just blowing up the test server and install a fresh new image but I would like to understand how this problem originated to avoid repeating whatever I did wrong..
    Last edited by telecastg; 09-06-2021, 01:25 AM.

  • #2
    Hello telecastg

    can you change this : put some global log.. . i think we need after more info :
    and see log file what have log ?

    $schema = $this->schemaProxy;
    $GLOBALS['log']->info(json_encode($shema) );

    try {
    $result = $schema->rebuild($entityList);
    }
    catch (Throwable $e) {
    $result = false;

    $GLOBALS['log']->info(
    'Fault to rebuild database schema. Details: '. $e->getMessage() .
    ' at ' . $e->getFile() . ':' . $e->getLine()
    );
    }

    Comment


    • #3
      Hello item

      Thanks for your prompt reply

      I added these lines to DataManager.php rebuildDatabase function:
      Code:
      $schema = $this->schemaProxy;
      
      $GLOBALS['log']->info('DataManager - rebuildDatabase() $entityList: ',[$entityList]);
      $GLOBALS['log']->info('DataManager - rebuildDatabase() $schema: ',[$schema]);
      $GLOBALS['log']->info(json_encode($schema) );
      
      try {
      $result = $schema->rebuild($entityList);
      }
      catch (Throwable $e) {
      $result = false;
      
      $GLOBALS['log']->error(
      'Fault to rebuild database schema. Details: '. $e->getMessage() .
      ' at ' . $e->getFile() . ':' . $e->getLine()
      );
      }
      and this is what came out in the log:
      Code:
      [2021-09-06 01:15:54] INFO: DataManager - rebuildDatabase() $entityList: [null] []
      
      [2021-09-06 01:15:54] INFO: DataManager - rebuildDatabase() $schema: [{"Espo\\Core\\Utils\\Database\\Schema\\SchemaProxy ":[]}] []
      
      [2021-09-06 01:15:54] INFO: {} [] []
      
      [2021-09-06 01:15:55] ALERT: Rebuild database fault: Error: Cannot use object of type stdClass as array in C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\Utils\Config.php:89 Stack trace: #0 C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\Utils\Database\Schema\rebuild Actions\AddSystemUser.php(38): Espo\Core\Utils\Config->get('systemUserAttri...') #1 C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\Utils\Database\Schema\Schema. php(328): Espo\Core\Utils\Database\Schema\rebuildActions\Add SystemUser->afterRebuild() #2 C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\Utils\Database\Schema\Schema. php(240): Espo\Core\Utils\Database\Schema\Schema->executeRebuildActions('afterRebuild') #3 C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\Utils\Database\Schema\SchemaP roxy.php(53): Espo\Core\Utils\Database\Schema\Schema->rebuild() #4 C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\DataManager.php(125): Espo\Core\Utils\Database\Schema\SchemaProxy->rebuild(NULL) #5 C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\DataManager.php(94): Espo\Core\DataManager->rebuildDatabase(NULL) #6 C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\ApplicationRunners\Rebuild.ph p(52): Espo\Core\DataManager->rebuild() #7 C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\Application.php(95): Espo\Core\ApplicationRunners\Rebuild->run() #8 C:\xampp\htdocs\tenantfriendly\execution_manager\r ebuild.php(37): Espo\Core\Application->run('Espo\\Core\\Appli...') #9 {main} [] []
      
      [2021-09-06 01:15:55] ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Error while rebuilding database. See log file for details." at C:\xampp\htdocs\tenantfriendly\execution_manager\a pplication\Espo\Core\DataManager.php line 137 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Error while rebuilding database. See log file for details. at C:\\xampp\\htdocs\\tenantfriendly\\execution_manag er\\application\\Espo\\Core\\DataManager.php:137)" } []
      As you can see, both $schema and $entityList are empty

      Best regards

      Comment


      • #4
        hello,

        look here :
        application/Espo/Core/Utils/Database/Schema/rebuildActions/AddSystemUser

        and here
        application/Espo/Resources/defaults/systemConfig.php

        seemts issue when check : systemUserAttributes
        it's a array

        Comment


        • #5
          Look here too with Log :





          So you can check SQL.

          application/Espo/Resources/defaults/
          for new config files.

          Comment


          • telecastg
            telecastg commented
            Editing a comment
            Thanks so much !. I will check those scripts.

            I ended up just dumping the "infected" image and installed a new one.

            Luckily it was a development image, so no great loss, but I will investigate how this issue came about for future reference.

        • #6
          Hello all
          i'm facing a problem in install Espocrm on hostgator shared host please advise.

          Your MySQL version is not supported by EspoCRM, please update to MySQL 5.7.0 at least

          Comment


          • telecastg
            telecastg commented
            Editing a comment
            You need to switch your hosting provider to one that has a current version of mysql or MariaDB. I use hostinger and have had no issues.

          • esforim
            esforim commented
            Editing a comment
            I was previously (still is for some server), unfortunately with Shared Hosting they only partial upgrade a few server which mine was not included. So we went to search for a replacement host and end up with Hostinger too.

            Hostinger is not the best but it serve purpose at the moment. The customer service is great though.

        • #7
          It is understandable, that you want to solve your problem, but please do not post the same thing twice and never in other`s threads, please.

          You have to tell hostgator to update MySQL.

          Comment

          Working...
          X