Closed
Description
Preconditions (*)
- Magento 2.3.2 & 2.3-develop
- Make env.php file read only:
chmod -w app/etc/env.php
orchmod 754 app/etc/env.php
Steps to reproduce (*)
- Run
php bin/magento maintenance:enable -v
Expected result (*)
- Maintenance mode should be enabled
Actual result (*)
In PathValidator.php line 63:
[Magento\Framework\Exception\ValidatorException]
Path "/var/www/html/magento2/app/etc/" cannot be used with directory "/var/www/html/magento2/app/etc/"
Exception trace:
() at /var/www/html/magento2/vendor/magento/framework/Filesystem/Directory/PathValidator.php:63
Magento\Framework\Filesystem\Directory\PathValidator->validate() at /var/www/html/magento2/vendor/magento/framework/Filesystem/Directory/Read.php:82
Magento\Framework\Filesystem\Directory\Read->validatePath() at /var/www/html/magento2/vendor/magento/framework/Filesystem/Directory/Read.php:111
Magento\Framework\Filesystem\Directory\Read->getAbsolutePath() at /var/www/html/magento2/vendor/magento/framework/Filesystem/Directory/Write.php:57
Magento\Framework\Filesystem\Directory\Write->assertWritable() at /var/www/html/magento2/vendor/magento/framework/Filesystem/Directory/Write.php:326
Magento\Framework\Filesystem\Directory\Write->openFile() at /var/www/html/magento2/vendor/magento/framework/Filesystem/Directory/Write.php:343
Magento\Framework\Filesystem\Directory\Write->writeFile() at /var/www/html/magento2/vendor/magento/framework/App/DeploymentConfig/Writer.php:146
Magento\Framework\App\DeploymentConfig\Writer->saveConfig() at /var/www/html/magento2/vendor/magento/framework/App/Cache/State.php:104
Magento\Framework\App\Cache\State->persist() at /var/www/html/magento2/vendor/magento/framework/App/Cache/Manager.php:77
Magento\Framework\App\Cache\Manager->setEnabled() at /var/www/html/magento2/vendor/magento/module-page-cache/Observer/SwitchPageCacheOnMaintenance.php:73
Magento\PageCache\Observer\SwitchPageCacheOnMaintenance->turnOffFullPageCache() at /var/www/html/magento2/vendor/magento/module-page-cache/Observer/SwitchPageCacheOnMaintenance.php:55
Magento\PageCache\Observer\SwitchPageCacheOnMaintenance->execute() at /var/www/html/magento2/vendor/magento/framework/Event/Invoker/InvokerDefault.php:88
Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod() at /var/www/html/magento2/vendor/magento/framework/Event/Invoker/InvokerDefault.php:74
Magento\Framework\Event\Invoker\InvokerDefault->dispatch() at /var/www/html/magento2/vendor/magento/framework/Event/Manager.php:66
Magento\Framework\Event\Manager->dispatch() at /var/www/html/magento2/vendor/magento/framework/App/MaintenanceMode.php:82
Magento\Framework\App\MaintenanceMode->set() at /var/www/html/magento2/setup/src/Magento/Setup/Console/Command/AbstractMaintenanceCommand.php:90
Magento\Setup\Console\Command\AbstractMaintenanceCommand->execute() at /var/www/html/magento2/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/magento2/vendor/symfony/console/Application.php:893
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/magento2/vendor/symfony/console/Application.php:262
Symfony\Component\Console\Application->doRun() at /var/www/html/magento2/vendor/magento/framework/Console/Cli.php:105
Magento\Framework\Console\Cli->doRun() at /var/www/html/magento2/vendor/symfony/console/Application.php:145
Symfony\Component\Console\Application->run() at /var/www/html/magento2/bin/magento:23
maintenance:enable [--ip IP] [--magento-init-params MAGENTO-INIT-PARAMS]
- Exception message isn't saying anything, message not valid at all.
Additional info
Why it's important to keep env.php
file read only - on production servers it's the only one way to make sure that no one will disable cache --> website will work fine.
My investigation shown that this issue appeared in 0e37353.
If i'll remove following observer - it works fine:
magento2/app/code/Magento/PageCache/etc/events.xml
Lines 60 to 62 in 0e37353
I reviewed this commit and actually it's ok that FPC should not cache pages in maintenance mode, but disabling FPC at all- the wrong way.
What I would suggest - revert changes that were done in 0e37353 and add checking for maintenance flag in when we're sending public Cache-Control
headers
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.4-develop branchGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentThe issue has been reproduced on latest 2.3 release