Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurring in failing update is not reported in the log #3308

Closed
pfrenssen opened this issue Jan 15, 2018 · 5 comments
Closed

Error occurring in failing update is not reported in the log #3308

pfrenssen opened this issue Jan 15, 2018 · 5 comments

Comments

@pfrenssen
Copy link
Member

This has been split off from #3303.

@claudiu-cristea reported in #3303 that if an error occurs during a database update this is not logged correctly. It appears this is only working correctly for exceptions being thrown in hook_update_N(), but not when a post-update fails.

We should fix this and extend the test coverage for post-updates.

@claudiu-cristea
Copy link
Member

claudiu-cristea commented Jan 15, 2018

@pfrenssen, I guess the problem is that messages logged in subsequent processes are not shown (have no explanation why for the moment). As hook_update_N() are running first, they manage to run in the main process, while post updates are spawned in subsequent processes. Just a guess.

@pfrenssen
Copy link
Member Author

I did some tests on the branch which is exhibiting the problems (ec-europa/joinup-dev#1045):

  • The error which is being thrown is Exception: The theme implementations may not be rendered until all modules are loaded. in Drupal\Core\Theme\ThemeManager->render() (line 139 of web/core/lib/Drupal/Core/Theme/ThemeManager.php). This is strange, why aren't the modules loaded?
  • The error only occurs when running hook_update_N() updates together with a post-update. If the hook_update_N() updates are run first, and then the post-update separately the exception is not thrown and the update finishes successfully.

@pfrenssen
Copy link
Member Author

I have fixed the missing log output in #3310.

I have also provided a test case for the The theme implementations may not be rendered until all modules are loaded exception in #3311, but I didn't have the time yet to investigate this.

@pfrenssen
Copy link
Member Author

I found the cause why the modules are not being loaded, this has been introduced in 978893e

In this commit the container is being rebuilt after calling drupal_flush_all_caches(), but look what this does:

public function rebuildContainer() {
  // Empty module properties and for them to be reloaded from scratch.
  $this->moduleList = NULL;
  [...]
}

@pfrenssen
Copy link
Member Author

OK this took me a long time to find since I was completely on the wrong track. I thought it was caused by the kernel juggling that was introduced recently in the UpdateKernel PR, but it turns out it was this container rebuild. I have a green test now:

$ UNISH_NO_TIMEOUTS=1 UNISH_TMP=/home/pieter/v/drush-sut php unish.phpunit.php tests/UpdateDBTest.php --stop-on-failure -vvv
Executing: '/home/pieter/v/drush-sut/drush-sut/vendor/bin/phpunit' --configuration /home/pieter/v/drush-sut/drush-sut/vendor/drush/drush/tests tests/UpdateDBTest.php --stop-on-failure -vvv
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

Runtime:	PHP 7.1.12
Configuration:	/home/pieter/v/drush/tests/phpunit.xml.dist

.....

Time: 1.3 minutes, Memory: 4.00MB

OK (5 tests, 11 assertions)

Posting fix in #3311.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants