Skip to content

[VarExporter] Doctrine Query Cache Fails Rehydration  #29406

Closed
@kiler129

Description

@kiler129

Symfony version(s) affected: 4.2.0

Description
Everything started with the following stacktrace (comming from 4.2.0 + Doctrine ORM v2.6.3):

09:40:16 WARNING   [cache] Failed to fetch key "%5Bb72c025cf288ac4aa4ccc822c726a95d%5D%5B1%5D"
[
  "key" => "%5Bb72c025cf288ac4aa4ccc822c726a95d%5D%5B1%5D",
  "exception" => Symfony\Component\VarExporter\Exception\NotInstantiableTypeException {
    #message: "Type "Doctrine\ORM\Query\Exec\AbstractSqlExecutor" is not instantiable."
    #code: 0
    #file: "./vendor/symfony/var-exporter/Internal/Registry.php"
    #line: 76
    trace: {
      ./vendor/symfony/var-exporter/Internal/Registry.php:76 { …}
      ./vendor/symfony/var-exporter/Internal/Hydrator.php:62 { …}
      ./vendor/symfony/var-exporter/Internal/Hydrator.php:41 { …}
      ./var/cache/prod/pools/yrz6rpPlAX/W/1/wZ+dYy9L2pl6hCB0KCTg:140 {
        ›     $o[0],
        ›     []
        › );
        arguments: {
          $objects: [ …3]
          $values: null
          $properties: [ …3]
          $value: Doctrine\ORM\Query\ParserResult { …}
          $wakeups: []
        }
      }
      ./vendor/symfony/cache/Traits/PhpFilesTrait.php:92 { …}
      ./vendor/symfony/cache/Adapter/AbstractAdapter.php:164 { …}
      ./vendor/symfony/cache/DoctrineProvider.php:54 { …}
      ./vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:60 { …}
      ./vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:271 { …}
      ./vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:231 { …}
      ./vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:902 { …}
      ./vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:667 { …}
      ./src/Command/Import/..../....php:271 { …}
      ./src/Command/Import/..../......:168 { …}
      ./vendor/symfony/console/Command/Command.php:255 { …}
      ./vendor/symfony/console/Application.php:919 { …}
      ./vendor/symfony/framework-bundle/Console/Application.php:89 { …}
      ./vendor/symfony/console/Application.php:262 { …}
      ./vendor/symfony/framework-bundle/Console/Application.php:75 { …}
      ./vendor/symfony/console/Application.php:145 { …}
      ./bin/console:44 { …}
    }
  }

How to reproduce
The code causing it is basically this:

$qb = $this->providerRepo->createQueryBuilder('
$q = $qb->getQuery();
$qi = $q->iterate();

First time it runs the cache file is saved: https://pastebin.com/raw/F0L5GKst
Next time code runs the cache file cannot be hydrated and causes the exception mentioned.

As @greg0ire suggested on Slack I dumped the object just before it's saved to cache: https://pastebin.com/raw/pn3eQUAC

Possible Solution
Unfortunately I have no idea how to fix the problem.

//ping @nicolas-grekas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions