Error related to cache/cron/reports - weird

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emillod
    Active Community Member
    • Apr 2017
    • 1405

    Error related to cache/cron/reports - weird

    Hello Guys,
    i don't know how to reproduce this error. Maybe you'll have an idea how to fix this issue. Basically user have to clear cache of EspoCRM every single day, because without this, he is not able to use EspoCRM at all.

    Every minute there is a new error in log:
    [2021-08-24 10:55:03] ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Bad data stored in file 'data/cache/application/webhooks.php'." at /var/www/html/espo/application/Espo/Core/Utils/File/Manager.php line 234 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Bad data stored in file 'data/cache/application/webhooks.php'. at /var/www/html/espo/application/Espo/Core/Utils/File/Manager.php:234)"} []
    [2021-08-24 10:56:02] ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Bad data stored in file 'data/cache/application/webhooks.php'." at /var/www/html/espo/application/Espo/Core/Utils/File/Manager.php line 234 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Bad data stored in file 'data/cache/application/webhooks.php'. at /var/www/html/espo/application/Espo/Core/Utils/File/Manager.php:234)"} []

    I also found this:
    [2021-08-24 11:00:05] ERROR: Report export fail[5fdaff610dd7f6173]: Bad data stored in file 'data/cache/application/webhooks.php'. [] []

    And here you have content of webhooks.php
    <?php
    return [];


    Any ideas?
  • dimyy
    Active Community Member
    • Jun 2018
    • 569

    #2
    I would look at the rights of the cron user.

    Comment

    • emillod
      Active Community Member
      • Apr 2017
      • 1405

      #3
      dimyy thanks for reply. I checked that. Cron user: www-data

      Comment

    • item
      Active Community Member
      • Mar 2017
      • 1476

      #4
      Hello,
      .. strange, can you put Log some where here in this function,
      why it's not a array
      application/Espo/Core/Utils/File/Manager.php

      try to print (log) the content of Webhook.php


      PHP Code:
      public function getPhpSafeContents(string $path)
      {
      if (!file_exists($path)) {
      throw new Error("Can't get contents from non-existing file '{$path}'.");
      }
      
      if (!strtolower(substr($path, -4)) == '.php') {
      throw new Error("Only PHP file are allowed for getting contents.");
      }
      
      $counter = 0;
      
      while ($counter < self::GET_SAFE_CONTENTS_RETRY_NUMBER) {
      $data = include($path);
      
      if (is_array($data) || $data instanceof StdClass) {
      return $data;
      }
      
      usleep(self::GET_SAFE_CONTENTS_RETRY_INTERVAL * 1000000);
      
      $counter ++;
      }
      
      throw new Error("Bad data stored in file '{$path}'.");
      } 
      
      Last edited by item; 08-24-2021, 08:26 PM.
      If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

      Comment


      • item
        item commented
        Editing a comment
        look too : i think the issue can resolved (find) there too :

        espo/core/webhook/manager.php
        i suppose you have some webhook event ?


        public function addEvent(string $event)
        {
        $this->data[$event] = true;

        if ($this->config->get('useCache')) {
        $this->storeDataToCache();
        }
        }

        /**
        * Remove an event. If no webhooks with this event left, then it will be removed from the cache.
        */
        public function removeEvent(string $event)
        {
        $notExists = !$this->entityManager
        ->getRepository('Webhook')
        ->select(['id'])
        ->where([
        'event' => $event,
        'isActive' => true,
        ])
        ->findOne();

        if ($notExists) {
        unset($this->data[$event]);

        if ($this->config->get('useCache')) {
        $this->storeDataToCache();
        }
        }
        }
    • item
      Active Community Member
      • Mar 2017
      • 1476

      #5
      i think
      espo/core/webhook/manager.php


      private $data = null; must be private $data = [];
      If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

      Comment

      • emillod
        Active Community Member
        • Apr 2017
        • 1405

        #6
        item and dimyy thanks for all replies. I'm still looking for solution. item - it's interesting, but this espo is not using webhooks https://i.imgur.com/L3zT08o.png
        I believe it's something with a cron, because there is an error every single minute, but i can't figure out what.. Also this error starts from ~5 am. And i saw that there is a backup script. I have theory, that maybe this script have some kind of impact? Idk..

        Comment


        • esforim
          esforim commented
          Editing a comment
          Would disablING the CRON work? Slowly do a few CRON task be able to help you track it down? Or disable all and see it it still happening.
          Last edited by esforim; 08-26-2021, 12:31 AM.
      Working...