I have not yet been able to fully diagnose this issue (hence the clumsy issue title), so I will describe it by its symptoms as first reported in #2773975: Error while installing checklist module: Checklist API lets other modules declare checklists by implementing a hook. Those checklists are turned into pages with routes created by a route subscriber in the API module. Client modules optionally provide their own menu links for those routes. Depending on how you install the modules, however, you get a RouteNotFoundException from the menu links. Specifically, the problem occurs when two conditions are true: 1) you are installing via the web UI, and 2) you install the modules one at a time (the API module in one step and a client module in a succeeding step). It works fine via Drush or Drupal Console, and the web UI works fine if you install both modules in the same step. I would assume the defect to be in my modules, were it not for the fact that they work perfectly if you just install them in the same step--a detail so seemingly irrelevant that it makes me suspect core.
Comments
Comment #2
cilefen commentedThis is interesting because #2572285: Module enabling and router rebuilding should be done in one transaction.
Comment #3
crag2012 commentedHave been attempting to get to grips with drupal for about 4 years (from6)
installation on G580 Lenovo, win 8.1, xampp-win32-7.0.9-1-VC14-installer (worked fine)
installing first core drupal-8.1.10 then drupal-8.1.9 both results same
although php.ini max_execution_time extended to 120s from 30 does report a timing error, if rerun from http://localhost/drupal/core/install.php
the error occurs
Seems a repeat of previous entries,
*****output**********
Additional uncaught exception thrown while handling exception.
Original
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 187 of C:\xampp\htdocs\drupal\core\lib\Drupal\Core\Routing\RouteProvider.php).
Drupal\Core\Routing\RouteProvider->getRouteByName('') (Line: 425)
Drupal\Core\Routing\UrlGenerator->getRoute('') (Line: 121)
Drupal\Core\Routing\UrlGenerator->getPathFromRoute('', Array) (Line: 68)
Drupal\Core\Render\MetadataBubblingUrlGenerator->getPathFromRoute('', Array) (Line: 772)
Drupal\Core\Url->getInternalPath() (Line: 99)
Drupal\Core\Path\PathMatcher->isFrontPage() (Line: 254)
system_theme_suggestions_html(Array)
call_user_func_array('system_theme_suggestions_html', Array) (Line: 402)
Drupal\Core\Extension\ModuleHandler->invokeAll('theme_suggestions_html', Array) (Line: 230)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 139)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 140)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 66)
Drupal\Core\Render\BareHtmlPageRenderer->renderBarePage(Array, Object, 'install_page', Array) (Line: 76)
Drupal\Core\ProxyClass\Render\BareHtmlPageRenderer->renderBarePage(Array, Object, 'install_page', Array) (Line: 998)
install_display_output(Array, Array) (Line: 154)
install_drupal(Object) (Line: 39)
Additional
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 187 of C:\xampp\htdocs\drupal\core\lib\Drupal\Core\Routing\RouteProvider.php).
Drupal\Core\Routing\RouteProvider->getRouteByName('') (Line: 425)
Drupal\Core\Routing\UrlGenerator->getRoute('') (Line: 277)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('', Array, Array, 1) (Line: 105)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('', Array, Array, ) (Line: 543)
Drupal::url('') (Line: 1356)
template_preprocess_page(Array) (Line: 1458)
template_preprocess_maintenance_page(Array) (Line: 1487)
template_preprocess_install_page(Array, 'install_page', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('install_page', Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 468)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 90)
__TwigTemplate_3ca16517bf3776375e3e02ac162becccac1bbe4172908107101d5ed2dce97277->doDisplay(Array, Array) (Line: 381)
Twig_Template->displayWithErrorHandling(Array, Array) (Line: 355)
Twig_Template->display(Array) (Line: 366)
Twig_Template->render(Array) (Line: 64)
twig_render_template('core/themes/classy/templates/layout/html.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 139)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 140)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 66)
Drupal\Core\Render\BareHtmlPageRenderer->renderBarePage(Array, 'Error', 'install_page', Array) (Line: 76)
Drupal\Core\ProxyClass\Render\BareHtmlPageRenderer->renderBarePage(Array, 'Error', 'install_page', Array) (Line: 998)
install_display_output(Array, Array, Array) (Line: 263)
_drupal_log_error(Array, 1) (Line: 564)
_drupal_exception_handler(Object)
*******end of output***********
not sure what to do next?
Comment #4
cilefen commented@crag2012 I am not sure the exception you saw is anything to do with this particular issue. There have been issues with Drupal requirements and the default setup of things like xampp. Please check the requirements and open another issue for what you have seen.
Comment #5
tim.plunkettDoes the menu link providing module explicitly depend on the route providing module?
Can you give more specific steps to reproduce?
Comment #6
traviscarden commentedYes, the module providing the menu link (
checklistapiexample) declares a dependency on the module providing the route (checklistapi). And the dependency is definitely already installed when the problem manifests.To reproduce using Checklist API:
RouteNotFoundException.You can browse the afflicted code on GitHub, if you like: https://github.com/TravisCarden/checklistapi/tree/8.x-1.0. Since that tag I have temporarily worked around the issue by manually declaring the route in the example module in addition to dynamically declaring it in the API module.
Comment #7
tim.plunkettReproduced, debugging.
Comment #8
tim.plunkettchecklistapi_get_checklist_info()uses drupal_static to store the list of definitions.ModuleInstaller::install() does not clear all statics, it only runs
drupal_static_reset('system_rebuild_module_data');So when your
\Drupal\checklistapi\Routing\ChecklistapiRouteSubscriber::routes()runs, it is given stale info.This is the correct fix for checklistapi.
Or, switch from an info hook to plugins, and then the call to
\Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();will take care of everything for you :)Comment #9
traviscarden commentedThank you very much, @tim.plunkett!