magento2: Since 2.3.2, we can no longer switch maintenance modes with an empty database
Preconditions (*)
- Magento 2.3.2
- PHP 7.2.19
Steps to reproduce (*)
- Setup Magento 2.3.1 using composer
- Drop the database and create it again so it’s empty (meaning: db has zero tables)
- Run
bin/magento maintenance:enable
orbin/magento maintenance:disable
- Notice that this works => good
- Setup Magento 2.3.2 using composer
- Drop the database and create it again so it’s empty (meaning: db has zero tables)
- Run
bin/magento maintenance:enable
orbin/magento maintenance:disable
- Notice that this crashes => not good
Expected result (*)
- Maintenance mode switching should work on an empty database like it did in Magento 2.3.1
Actual result (*)
- We get this error (including stack trace):
$ bin/magento maintenance:enable -vvv
In Mysql.php line 110:
[Zend_Db_Statement_Exception (42)]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento23-test.core_config_data' doesn't exist, query was: SELECT `main_table`.* FROM `core_config_data` AS `main_table`
Exception trace:
() at vendor/magento/framework/DB/Statement/Pdo/Mysql.php:110
Magento\Framework\DB\Statement\Pdo\Mysql->tryExecute() at vendor/magento/framework/DB/Statement/Pdo/Mysql.php:92
Magento\Framework\DB\Statement\Pdo\Mysql->_execute() at vendor/magento/zendframework1/library/Zend/Db/Statement.php:303
Zend_Db_Statement->execute() at vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:480
Zend_Db_Adapter_Abstract->query() at vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:238
Zend_Db_Adapter_Pdo_Abstract->query() at vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:542
Magento\Framework\DB\Adapter\Pdo\Mysql->_query() at vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:617
Magento\Framework\DB\Adapter\Pdo\Mysql->query() at vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:737
Zend_Db_Adapter_Abstract->fetchAll() at vendor/magento/framework/Data/Collection/Db/FetchStrategy/Query.php:21
Magento\Framework\Data\Collection\Db\FetchStrategy\Query->fetchAll() at vendor/magento/framework/Data/Collection/AbstractDb.php:778
Magento\Framework\Data\Collection\AbstractDb->_fetchAll() at vendor/magento/framework/Data/Collection/AbstractDb.php:673
Magento\Framework\Data\Collection\AbstractDb->getData() at vendor/magento/framework/Data/Collection/AbstractDb.php:576
Magento\Framework\Data\Collection\AbstractDb->loadWithFilter() at vendor/magento/framework/Data/Collection/AbstractDb.php:561
Magento\Framework\Data\Collection\AbstractDb->load() at vendor/magento/framework/Data/Collection.php:838
Magento\Framework\Data\Collection->getIterator() at vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php:82
Magento\Config\App\Config\Source\RuntimeConfigSource->loadConfig() at vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php:62
Magento\Config\App\Config\Source\RuntimeConfigSource->get() at vendor/magento/framework/App/Config/ConfigSourceAggregated.php:40
Magento\Framework\App\Config\ConfigSourceAggregated->get() at vendor/magento/module-config/App/Config/Type/System/Reader.php:60
Magento\Config\App\Config\Type\System\Reader->read() at generated/code/Magento/Config/App/Config/Type/System/Reader/Proxy.php:95
Magento\Config\App\Config\Type\System\Reader\Proxy->read() at vendor/magento/module-config/App/Config/Type/System.php:371
Magento\Config\App\Config\Type\System->readData() at vendor/magento/framework/Cache/LockGuardedCacheLoader.php:79
Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData() at vendor/magento/module-config/App/Config/Type/System.php:261
Magento\Config\App\Config\Type\System->loadDefaultScopeData() at vendor/magento/module-config/App/Config/Type/System.php:195
Magento\Config\App\Config\Type\System->getWithParts() at vendor/magento/module-config/App/Config/Type/System.php:169
Magento\Config\App\Config\Type\System->get() at vendor/magento/framework/App/Config.php:131
Magento\Framework\App\Config->get() at vendor/magento/framework/App/Config.php:80
Magento\Framework\App\Config->getValue() at vendor/magento/module-page-cache/Model/Config.php:119
Magento\PageCache\Model\Config->getType() at vendor/magento/module-cache-invalidate/Observer/FlushAllCacheObserver.php:45
Magento\CacheInvalidate\Observer\FlushAllCacheObserver->execute() at vendor/magento/framework/Event/Invoker/InvokerDefault.php:88
Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod() at vendor/magento/framework/Event/Invoker/InvokerDefault.php:74
Magento\Framework\Event\Invoker\InvokerDefault->dispatch() at vendor/magento/framework/Event/Manager.php:66
Magento\Framework\Event\Manager->dispatch() at generated/code/Magento/Framework/Event/Manager/Proxy.php:95
Magento\Framework\Event\Manager\Proxy->dispatch() at vendor/magento/module-page-cache/Model/Cache/Type.php:51
Magento\PageCache\Model\Cache\Type->clean() at vendor/magento/framework/App/Cache/TypeList.php:194
Magento\Framework\App\Cache\TypeList->cleanType() at vendor/magento/framework/App/Cache/Manager.php:91
Magento\Framework\App\Cache\Manager->clean() at vendor/magento/module-page-cache/Observer/SwitchPageCacheOnMaintenance.php:72
Magento\PageCache\Observer\SwitchPageCacheOnMaintenance->turnOffFullPageCache() at vendor/magento/module-page-cache/Observer/SwitchPageCacheOnMaintenance.php:55
Magento\PageCache\Observer\SwitchPageCacheOnMaintenance->execute() at vendor/magento/framework/Event/Invoker/InvokerDefault.php:88
Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod() at vendor/magento/framework/Event/Invoker/InvokerDefault.php:74
Magento\Framework\Event\Invoker\InvokerDefault->dispatch() at vendor/magento/framework/Event/Manager.php:66
Magento\Framework\Event\Manager->dispatch() at vendor/magento/framework/App/MaintenanceMode.php:82
Magento\Framework\App\MaintenanceMode->set() at setup/src/Magento/Setup/Console/Command/AbstractMaintenanceCommand.php:90
Magento\Setup\Console\Command\AbstractMaintenanceCommand->execute() at vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at vendor/symfony/console/Application.php:893
Symfony\Component\Console\Application->doRunCommand() at vendor/symfony/console/Application.php:262
Symfony\Component\Console\Application->doRun() at vendor/magento/framework/Console/Cli.php:105
Magento\Framework\Console\Cli->doRun() at vendor/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at bin/magento:23
In Mysql.php line 91:
[PDOException (42S02)]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento23-test.core_config_data' doesn't exist
Exception trace:
() at vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91
PDOStatement->execute() at vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91
Magento\Framework\DB\Statement\Pdo\Mysql->Magento\Framework\DB\Statement\Pdo\{closure}() at vendor/magento/framework/DB/Statement/Pdo/Mysql.php:107
Magento\Framework\DB\Statement\Pdo\Mysql->tryExecute() at vendor/magento/framework/DB/Statement/Pdo/Mysql.php:92
Magento\Framework\DB\Statement\Pdo\Mysql->_execute() at vendor/magento/zendframework1/library/Zend/Db/Statement.php:303
Zend_Db_Statement->execute() at vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:480
Zend_Db_Adapter_Abstract->query() at vendor/magento/zendframework1/library/Zend/Db/Adapter/Pdo/Abstract.php:238
Zend_Db_Adapter_Pdo_Abstract->query() at vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:542
Magento\Framework\DB\Adapter\Pdo\Mysql->_query() at vendor/magento/framework/DB/Adapter/Pdo/Mysql.php:617
Magento\Framework\DB\Adapter\Pdo\Mysql->query() at vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php:737
Zend_Db_Adapter_Abstract->fetchAll() at vendor/magento/framework/Data/Collection/Db/FetchStrategy/Query.php:21
Magento\Framework\Data\Collection\Db\FetchStrategy\Query->fetchAll() at vendor/magento/framework/Data/Collection/AbstractDb.php:778
Magento\Framework\Data\Collection\AbstractDb->_fetchAll() at vendor/magento/framework/Data/Collection/AbstractDb.php:673
Magento\Framework\Data\Collection\AbstractDb->getData() at vendor/magento/framework/Data/Collection/AbstractDb.php:576
Magento\Framework\Data\Collection\AbstractDb->loadWithFilter() at vendor/magento/framework/Data/Collection/AbstractDb.php:561
Magento\Framework\Data\Collection\AbstractDb->load() at vendor/magento/framework/Data/Collection.php:838
Magento\Framework\Data\Collection->getIterator() at vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php:82
Magento\Config\App\Config\Source\RuntimeConfigSource->loadConfig() at vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php:62
Magento\Config\App\Config\Source\RuntimeConfigSource->get() at vendor/magento/framework/App/Config/ConfigSourceAggregated.php:40
Magento\Framework\App\Config\ConfigSourceAggregated->get() at vendor/magento/module-config/App/Config/Type/System/Reader.php:60
Magento\Config\App\Config\Type\System\Reader->read() at generated/code/Magento/Config/App/Config/Type/System/Reader/Proxy.php:95
Magento\Config\App\Config\Type\System\Reader\Proxy->read() at vendor/magento/module-config/App/Config/Type/System.php:371
Magento\Config\App\Config\Type\System->readData() at vendor/magento/framework/Cache/LockGuardedCacheLoader.php:79
Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData() at vendor/magento/module-config/App/Config/Type/System.php:261
Magento\Config\App\Config\Type\System->loadDefaultScopeData() at vendor/magento/module-config/App/Config/Type/System.php:195
Magento\Config\App\Config\Type\System->getWithParts() at vendor/magento/module-config/App/Config/Type/System.php:169
Magento\Config\App\Config\Type\System->get() at vendor/magento/framework/App/Config.php:131
Magento\Framework\App\Config->get() at vendor/magento/framework/App/Config.php:80
Magento\Framework\App\Config->getValue() at vendor/magento/module-page-cache/Model/Config.php:119
Magento\PageCache\Model\Config->getType() at vendor/magento/module-cache-invalidate/Observer/FlushAllCacheObserver.php:45
Magento\CacheInvalidate\Observer\FlushAllCacheObserver->execute() at vendor/magento/framework/Event/Invoker/InvokerDefault.php:88
Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod() at vendor/magento/framework/Event/Invoker/InvokerDefault.php:74
Magento\Framework\Event\Invoker\InvokerDefault->dispatch() at vendor/magento/framework/Event/Manager.php:66
Magento\Framework\Event\Manager->dispatch() at generated/code/Magento/Framework/Event/Manager/Proxy.php:95
Magento\Framework\Event\Manager\Proxy->dispatch() at vendor/magento/module-page-cache/Model/Cache/Type.php:51
Magento\PageCache\Model\Cache\Type->clean() at vendor/magento/framework/App/Cache/TypeList.php:194
Magento\Framework\App\Cache\TypeList->cleanType() at vendor/magento/framework/App/Cache/Manager.php:91
Magento\Framework\App\Cache\Manager->clean() at vendor/magento/module-page-cache/Observer/SwitchPageCacheOnMaintenance.php:72
Magento\PageCache\Observer\SwitchPageCacheOnMaintenance->turnOffFullPageCache() at vendor/magento/module-page-cache/Observer/SwitchPageCacheOnMaintenance.php:55
Magento\PageCache\Observer\SwitchPageCacheOnMaintenance->execute() at vendor/magento/framework/Event/Invoker/InvokerDefault.php:88
Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod() at vendor/magento/framework/Event/Invoker/InvokerDefault.php:74
Magento\Framework\Event\Invoker\InvokerDefault->dispatch() at vendor/magento/framework/Event/Manager.php:66
Magento\Framework\Event\Manager->dispatch() at vendor/magento/framework/App/MaintenanceMode.php:82
Magento\Framework\App\MaintenanceMode->set() at setup/src/Magento/Setup/Console/Command/AbstractMaintenanceCommand.php:90
Magento\Setup\Console\Command\AbstractMaintenanceCommand->execute() at vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at vendor/symfony/console/Application.php:893
Symfony\Component\Console\Application->doRunCommand() at vendor/symfony/console/Application.php:262
Symfony\Component\Console\Application->doRun() at vendor/magento/framework/Console/Cli.php:105
Magento\Framework\Console\Cli->doRun() at vendor/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at bin/magento:23
maintenance:enable [--ip IP] [--magento-init-params MAGENTO-INIT-PARAMS]
Discussion
I understand this is a weird case, but we have some script in our workflow which runs against this problem and I was a bit surprised to see this happening now in 2.3.2
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (16 by maintainers)
Commits related to this issue
- Fix for #23577. Check if db tables for config data exists before fetch data. — committed to ivanko-dev/magento2 by ivanko-dev 5 years ago
- ENGCOM-6059: Fix for #23577. Check if db tables for config data exists before fetch #24959 - Merge Pull Request magento/magento2#24959 from ivan-koliadynskyy/magento2:maintance-mode-without-db-table... — committed to magento/magento2 by magento-engcom-team 5 years ago
- ENGCOM-6059: Fix for #23577. Check if db tables for config data exists before fetch #24959 — committed to magento/magento2 by VladimirZaets 5 years ago
@magento-engcom-team @ivan-koliadynskyy Can anyone check this comment ? https://github.com/magento/magento2/issues/26692#issuecomment-589086483
if the check result is not cached and it can affect performance and increase DB load ?
Hi @hostep. Thank you for your report. The issue has been fixed in magento/magento2#24959 by @ivan-koliadynskyy in 2.3-develop branch Related commit(s):
The fix will be available with the upcoming 2.3.4 release.
@hostep now i reproduced it . Thank you for your collaboration !
Say what? Can you explain please, this makes no sense?
If you mean that the tag 2.3.2 isn’t going to be merged in 2.3-develop, but all the feature branches which were merged in 2.3.2 are going to be merged in 2.3-develop, then that’s fine as well, but it needs to happen pretty soon if possible!
Like how are we supposed to send in bugfixes for code which is part of 2.3.2 but not yet part of 2.3-develop? And how can you guys try to verify issue reports from Magento 2.3.2 if the code of 2.3.2 isn’t merged in 2.3-develop?