I am getting the following error in my Magento application sometimes, it's not breaking the application always but in regular interval I am getting this error.
The application CPU usage is also going high sometimes. Application is using redis for both caching and session. Database is AWS Aurora.
[Tue Jul 16 15:41:41.849749 2019] [:error] [pid 6506] [client 10.101.8.81:26870] PHP Fatal error: Uncaught Error: Call to undefined method Magento\Catalog\Model\ResourceModel\Product\Interceptor::_construct() in /mnt/drive1/www/magento-2019年07月08日-06-50-51/vendor/magento/framework/Model/ResourceModel/AbstractResource.php:40\nStack trace:\n#0 /mnt/drive1/www/magento-2019年07月08日-06-50-51/vendor/magento/module-eav/Model/Entity/AbstractEntity.php(234): Magento\Framework\Model\ResourceModel\AbstractResource->__construct()\n#1 /mnt/drive1/www/magento-2019年07月08日-06-50-51/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php(51): Magento\Eav\Model\Entity\AbstractEntity->__construct(Object(Magento\Eav\Model\Entity\Context), Array)\n#2 /mnt/drive1/www/magento-2019年07月08日-06-50-51/vendor/magento/module-catalog/Model/ResourceModel/Product.php(130): Magento\Catalog\Model\ResourceModel\AbstractResource->__construct(Object(Magento\Eav\Model\Entity\Context), Object(Magento\Store\Model\StoreManager), Object(Magento\Catalog\Model\Factory), Array)\n#3 /mnt/drive1/www/magento-2019年07月08日-06-50-51/generated/code/Magen in /mnt/drive1/www/magento-2019年07月08日-06-50-51/vendor/magento/framework/Model/ResourceModel/AbstractResource.php on line 40,
Another similar error
PHP Fatal error: Couldn't execute method Composer\Autoload\ClassLoader::composer\autoload\classloader::loadclass\x03 in Unknown on line 0, referer:
1 Answer 1
Have you tried clearing generated directories?
Enable Maintenance Mode, then:
rm -rf /path-to-install-dir/generated/code/* /path-to-install-dir/generated/metadata/*
After that,
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
If you're not in a production environment, you can clear redis cache by running
redis-cli:flushall
You may need to update/upgrade composer as well.