RouteProvider pretends no routes if database connection lost, poisoning cache downstream

Created on 17 November 2023, 11 months ago

Problem/Motivation

RouteProvider can return as if no routes exist when they do if there is an interruption to the database. It should crash.

I discovered this looking into a PluginNotFoundException for LocalTaskManager when calling getLocalTasksForRoute.

It's possible for the definition cache in LocalTaskManager to get poisoned with an incomplete list of views plugins during a database interruption. This is because most of the discovery is via YML files and derivatives - and only views module requires access to the database - for routes when calling getRoutesByPattern. In the case of lost database connection, all views plugins providing local tasks with path plugin displays would disappear from the definitions as getRoutesByPattern ignores missing connection to database and returns as if no route exists when it attempts to get the route for the view. The cache will then successfully receive this incomplete list if the cache is online. I think it's likely in my case there is a race - database and cache drop offline due to network drop - this triggers definition cache miss (cache miss happens on failure to connect - not fatal) - and then by the time it finishes - due to not needing the database to be online - cache store can succeed if cache is now back online.

If you then still have cached local tasks for route (getLocalTasksForRoute has its own cache) it's possible for getLocalTasksForRoute to trigger PluginNotFoundException as it loads a cache based on definitions including views whereas the current definitions cache is poisoned to not include them. This persists until a manual cache clear.

Steps to reproduce

Difficult to reproduce but I have a test that tests it and you can see in code if the query for routes fails it is silently ignored as if the table did not exist (similar to how config handles just in time table creation).

Proposed resolution

Check table existence before ignoring the error, which will throw if the database connectivity was interrupted, or will successfully confirm the table did not exist before returning empty.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

-

πŸ› Bug report
Status

Active

Version

10.0 ✨

Component
RoutingΒ  β†’

Last updated 16 days ago

Created by

πŸ‡¬πŸ‡§United Kingdom Driskell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Driskell
  • Status changed to Postponed: needs info 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom Driskell

    Just flagging postponed as I am trying to resolve my assumptions on the views overrides - I think that's incorrect. So will update as I find time.

    The RouteProvider issue is there it's just unclear whether it's tied exactly to my problem with PluginNotFoundException so just want to dig to make sure it nothing else. Will submit a patch later on for it too.

  • Status changed to Active 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom Driskell

    Updated IS. Confirmed that it not just override views. It's all views providing a path. I think in my case with my PluginNotFoundException when it lists the plugins that were found it only contains a small number (5 in my case) of view plugins. The rest are missing. No consistency to this list.

Production build 0.71.5 2024