getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.59k stars 1.41k forks source link

Grav update from 1.7.43 to 1.7.44 failed #3787

Open matt-j-m opened 10 months ago

matt-j-m commented 10 months ago

Attempting to update via Admin panel results in the following error (and the entire site being inaccessible):

grav.CRITICAL: include([install dir]\vendor\composer/../../system/src/Grav/Framework/Psr7/Response.php): Failed to open stream: No such file or directory

After restoring from working backup I attempted updating from CLI (php bin/gpm selfupgrade -f) with the following result:

Preparing to upgrade to v1.7.44.. |- Downloading upgrade [8.94M]... 100% |- Installing upgrade... error | '- Unknown error '- Installation failed or aborted.

No additional errors in error log. Also the bin directory is now completely empty, though this may just be a symptom of the aborted install.

All plugins were on latest before attempting core upgrade.

matt-j-m commented 10 months ago

Full backtrace error with path redacted:

grav.CRITICAL: include(C:\Users[redacted]\vendor\composer/../../system/src/Grav/Framework/Psr7/Response.php): Failed to open stream: No such file or directory - Trace: #0 C:\Users[redacted]\system\src\Grav\Common\Debugger.php(843): Whoops\Run->handleError(2, 'include(C:\User...', 'C:\Users\[redacted]...', 576) #1 C:\Users[redacted]\vendor\composer\ClassLoader.php(576): Grav\Common\Debugger->deprecatedErrorHandler(2, 'include(C:\User...', 'C:\Users\[redacted]...', 576) #2 C:\Users[redacted]\vendor\composer\ClassLoader.php(576): include('C:\Users\[redacted]...') #3 C:\Users[redacted]\vendor\composer\ClassLoader.php(427): Composer\Autoload{closure}('C:\Users\[redacted]...') #4 C:\Users[redacted]\system\src\Grav\Framework\Controller\Traits\ControllerResponseTrait.php(80): Composer\Autoload\ClassLoader->loadClass('Grav\Framework\...') #5 C:\Users[redacted]\user\plugins\admin\classes\plugin\AdminBaseController.php(234): Grav\Plugin\Admin\AdminBaseController->createJsonResponse(Array, 200) #6 C:\Users[redacted]\user\plugins\admin\classes\plugin\AdminController.php(791): Grav\Plugin\Admin\AdminBaseController->sendJsonResponse(Array) #7 C:\Users[redacted]\user\plugins\admin\classes\plugin\AdminBaseController.php(111): Grav\Plugin\Admin\AdminController->taskUpdategrav() #8 C:\Users[redacted]\user\plugins\admin\admin.php(1008): Grav\Plugin\Admin\AdminBaseController->execute() #9 C:\Users[redacted]\user\plugins\admin\admin.php(558): Grav\Plugin\AdminPlugin->initializeController('updategrav', NULL) #10 C:\Users[redacted]\vendor\symfony\event-dispatcher\EventDispatcher.php(264): Grav\Plugin\AdminPlugin->onPagesInitialized(Object(RocketTheme\Toolbox\Event\Event), 'onPagesInitiali...', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #11 C:\Users[redacted]\vendor\symfony\event-dispatcher\EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'onPagesInitiali...', Object(RocketTheme\Toolbox\Event\Event)) #12 C:\Users[redacted]\vendor\symfony\event-dispatcher\EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'onPagesInitiali...', Object(RocketTheme\Toolbox\Event\Event)) #13 C:\Users[redacted]\system\src\Grav\Common\Grav.php(597): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(RocketTheme\Toolbox\Event\Event), 'onPagesInitiali...') #14 C:\Users[redacted]\system\src\Grav\Common\Processors\PagesProcessor.php(53): Grav\Common\Grav->fireEvent('onPagesInitiali...', Object(RocketTheme\Toolbox\Event\Event)) #15 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\PagesProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #16 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #17 C:\Users[redacted]\system\src\Grav\Common\Processors\TwigProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #18 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\TwigProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #19 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #20 C:\Users[redacted]\system\src\Grav\Common\Processors\AssetsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #21 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\AssetsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #22 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #23 C:\Users[redacted]\system\src\Grav\Common\Processors\SchedulerProcessor.php(40): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #24 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\SchedulerProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #25 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #26 C:\Users[redacted]\system\src\Grav\Common\Processors\BackupsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #27 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\BackupsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #28 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #29 C:\Users[redacted]\system\src\Grav\Common\Processors\TasksProcessor.php(69): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #30 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\TasksProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #31 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #32 C:\Users[redacted]\user\plugins\admin\classes\plugin\Router.php(72): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #33 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Plugin\Admin\Router->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #34 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #35 C:\Users[redacted]\system\src\Grav\Common\Processors\RequestProcessor.php(64): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #36 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\RequestProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #37 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #38 C:\Users[redacted]\system\src\Grav\Common\Processors\ThemesProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #39 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\ThemesProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #40 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #41 C:\Users[redacted]\system\src\Grav\Common\Processors\PluginsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #42 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\PluginsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #43 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #44 C:\Users[redacted]\system\src\Grav\Common\Processors\InitializeProcessor.php(130): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #45 C:\Users[redacted]\system\src\Grav\Common\Debugger.php(546): Grav\Common\Processors\InitializeProcessor::Grav\Common\Processors{closure}() #46 C:\Users[redacted]\system\src\Grav\Common\Processors\InitializeProcessor.php(131): Grav\Common\Debugger->profile(Object(Closure)) #47 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Common\Processors\InitializeProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #48 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #49 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Middlewares\MultipartRequestSupport.php(40): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #50 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(50): Grav\Framework\RequestHandler\Middlewares\MultipartRequestSupport->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #51 C:\Users[redacted]\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #52 C:\Users[redacted]\system\src\Grav\Common\Grav.php(312): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #53 C:\Users[redacted]\index.php(47): Grav\Common\Grav->process() #54 C:\Users[redacted]\system\router.php(55): require('C:\Users\[redacted]...') #55 {main} [] []

rhukster commented 10 months ago

Cannot replicate:

➜ bin/gpm self-upgrade

GPM Releases Configuration: Stable

Grav v1.7.44 is now available [release date: Fri Jan  5 12:45:36 2024].
You are currently using v1.7.43.

 Would you like to read the changelog before proceeding? [y|N]  (yes/no) [no]:
 > n

 Would you like to upgrade now? [y|N]  (yes/no) [no]:
 > y

Preparing to upgrade to v1.7.44..
  |- Downloading upgrade [8.94M]...   100%
  |- Installing upgrade...    ok
  '- Success!

Might of been a network glitch, or github itself having an issue. Please try again.

matt-j-m commented 10 months ago

Thanks for the reply @rhukster. I tried again in my local Windows 11 environment, with the same result: "Unknown error". I got to thinking maybe the OS had something to do with it, so I spun up a Debian instance within WSL, cloned the site and tried again. Success!

$ bin/gpm selfupgrade -f

GPM Releases Configuration: Stable

Grav v1.7.44 is now available [release date: Fri Jan  5 12:45:36 2024].
You are currently using v1.7.43.

 Would you like to read the changelog before proceeding? [y|N]  (yes/no) [no]:
 >

 Would you like to upgrade now? [y|N]  (yes/no) [no]:
 > yes

Preparing to upgrade to v1.7.44..
  |- Downloading upgrade [8.94M]...   100%
  |- Installing upgrade...    ok
  '- Success!

Hopefully this is just a glitch limited to this particular update or to my specific environment (though I've never had issues with this process before). But let me know if I can assist with any further troubleshooting in Windows. Cheers.

yankl commented 9 months ago

I'm having same or similar issue. Upgrade from 1.7.43 to 1.7.44 in admin plugin failed several times on different days. Then today tried it on command line and got this:

Preparing to upgrade to v1.7.44..
  |- Downloading upgrade [8.94M]...   100%
  |- Installing upgrade...    error
  |  '- Unknown error
  '- Installation failed or aborted.

And my bin folder is also now empty. I'm also on Windows.

lufog commented 9 months ago

Same problem on Windows

rhukster commented 9 months ago

Can you try with WSL?

lufog commented 9 months ago

Sorry, I've never used WSL and don't want to spend time installing/configuring it. To immediately delete after checking. But I can send any logs, or check any test versions/scripts (for example, which prints more detailed messages about the installation process in the console).

Grav's self-upgrade does not work both when using the command and when using the admin panel.

The problem appeared much earlier than version 1.7.43, but previously I simply updated Grav using grav-update-ver.zip. Plugins are updated without problems from the admin panel.

More info: Windows 11 PHP 8.3 (8.3.3) VS16 x64 Non Thread Safe (2024-Feb-13 23:38:22) Enabled modules: curl, gd, mbstring, openssl, zip

image

lufog commented 8 months ago

Well, I'll play around with xdebug, maybe I can find out the reason.

lufog commented 8 months ago

Update process breaks here:

https://github.com/getgrav/grav/blob/4149c81339274130742831422de2685f298f3a6e/system/src/Grav/Common/GPM/Installer.php#L308-L314

when $file->getPathname() is bin It's as if the bin folder cannot be deleted because the gpm script is running.


Yeah, if I add

if ($file->getFilename() === 'bin') {
    continue;
}

after

https://github.com/getgrav/grav/blob/4149c81339274130742831422de2685f298f3a6e/system/src/Grav/Common/GPM/Installer.php#L302-L304

everything works fine

image


https://github.com/getgrav/grav/blob/4149c81339274130742831422de2685f298f3a6e/system/src/Grav/Common/Filesystem/Folder.php#L543

For some reason, on Windows, unlink() does not release the gpm script occupied by the interpreter :/

lufog commented 8 months ago

The problem only occurs on PHP 8 (8.1.27, 8.2.16, 8.3.3). On PHP 7 (7.4.33) the installation proceeds without errors.

Apparently the behavior of the unlink() was changed in PHP 8 (on Windows), or maybe it's a regression.

yankl commented 8 months ago

I'm having the same issue now trying to upgrade from 1.7.44 to 1.7.45

matt-j-m commented 7 months ago

The problem only occurs on PHP 8 (8.1.27, 8.2.16, 8.3.3). On PHP 7 (7.4.33) the installation proceeds without errors.

Apparently the behavior of the unlink() was changed in PHP 8 (on Windows), or maybe it's a regression.

+1 for this. Updating from 1.7.44 to 1.7.45 failed under Windows 11 on PHP 8.1.25, worked perfectly on PHP 7.4.9.

lufog commented 7 months ago

@matt-j-m, judging by issues in the PHP repository, in PHP 8, after refactoring code, developers broke the deletion and renaming of occupied files under Windows. The problem is known, there is even a pull request with a fix (opened two years ago). All that remains is to wait for PHP to fix the problem (which is clearly not a priority for them) or to add a crutch to Grav, as Symfony did (a more realistic solution).

rhukster commented 7 months ago

Yes this is a PHP core change that breaks windows. If anyone can provide a pull request that uses a Symfony-like workaround, I would be glad to include it. I don't run windows so hard for me to do this.