Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-21940

delete location doesn't fully expire stash cache

    Details

      Description

      LocationService->loadLocationChildren throws an exception, sometimes, when I attempt to load children from a location where content has been deleted and re-inserted.

      steps to reproduce:
      • Import the code below as a new command to execute later
      • Create 3 folders at the root node: folder A, folder B, folder C
      • Add a secondary location of folder C inside folder A
      • Add a secondary location of folder B inside folder A
      • execute the command => output 2
      • Delete the secondary location of folder B that is in folder A
      • execute the command => output 1
      • Add a secondary location of folder B inside folder A
      • execute the command => failure
        => Expected result: 2 nodes should be counted
        => Actual result: Raised exception: Could not find 'location' with identifier '142'

        $userId = 10;
        $nodeId = <folderA-nodeId>;
        $repository = $this->getContainer()->get( 'ezpublish.api.repository' );
        $repository->setCurrentUser( $repository->getUserService()->loadUser( $userId) );
        $locationService = $repository->getLocationService();
        $rootLocation = $locationService->loadLocation( $nodeId ); 
       
        $allItems = $locationService->loadLocationChildren( $rootLocation );
        $output->writeln( "loadLocationChildren" );
      //  $output->writeln( print_r( $allItems, true ) );
        $output->writeln( count( $allItems );
      

        Issue Links

          Activity

          Hide
          Gaetano Giunta (Inactive) added a comment - - edited

          Alternative way to reproduce the error (php code, the prerequisite steps are identical): you can also

          • fetch the child locations using legacy stack code, then
          • loop on each one, load it as location by its node id
          • and for each one call loadLocations() => ERROR it seems this one tries to load a now-no-more-existing location

          Also this seems to relate to SPI cache, as clearing it fixes the problem

          Show
          Gaetano Giunta (Inactive) added a comment - - edited Alternative way to reproduce the error (php code, the prerequisite steps are identical): you can also fetch the child locations using legacy stack code, then loop on each one, load it as location by its node id and for each one call loadLocations() => ERROR it seems this one tries to load a now-no-more-existing location Also this seems to relate to SPI cache, as clearing it fixes the problem
          Hide
          Bertrand Dunogier added a comment -

          Joao, feel free to move the issue to dev review.

          Show
          Bertrand Dunogier added a comment - Joao, feel free to move the issue to dev review.
          Show
          Joao Inacio (Inactive) added a comment - Merged in master: https://github.com/ezsystems/ezpublish-kernel/commit/ef6965b15ff3c047a4af5dd48a3ea96cb51b6974
          Hide
          Joao Pingo (Inactive) added a comment -

          QA Approved

          Show
          Joao Pingo (Inactive) added a comment - QA Approved

            People

            • Assignee:
              Unassigned
              Reporter:
              Joaquim Cavalleri (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 4 hours
                1d 4h