The problem that Crell ran into in trying to address request scope dependency issues in #1874500: CMF-based Routing system is one that I mistakenly ignored when working on #1269742: Make path lookup code into a pluggable class - which means the code in there is faulty :-(

  public function writeCache() {
    $path_lookups = $this->getPathLookups();
    // Check if the system paths for this page were loaded from cache in this
    // request to avoid writing to cache on every request.
    if ($this->cacheNeedsWriting && !empty($path_lookups) && !empty($this->cacheKeys)) {
      // Use the system path of the current request for the cache ID (cid).
      $cid = end($this->cacheKeys);
      // Set the path cache to expire in 24 hours.
      $expire = REQUEST_TIME + (60 * 60 * 24);
      $this->cache->set($cid, $path_lookups, $expire);
    }
    // We are at the end of the request, so pop off the last request path.
    array_pop($this->cacheKeys);
  }

That last comment is completely delusional - this gets called when the kernel terminates, *not* at the end of a request. There is currently no way to make sure this gets called at the end of each (sub)request. But apparently fabpot is working on a solution: https://github.com/symfony/symfony/issues/5300

In the meantime we should try and come up with something that is at least less utterly false.

CommentFileSizeAuthor
#2 1891692.fix-system-path-caching.patch3.05 KBkatbailey
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

katbailey’s picture

Chatted with Crell and catch about this and the consensus is that we only want the writeCache() method to run for the master request - will roll a patch tonight.

katbailey’s picture

Status: Active » Needs review
FileSize
3.05 KB
Crell’s picture

Status: Needs review » Reviewed & tested by the community

Assuming the bot approves, this is nice and straightforward. It would be good to get in before we merge the alias logic in with the generator in #1888424: Make Drupal's URL generation logic available to HttpKernel, and minimize code repetition/divergence

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.