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

JavaScript error when opening the content tree after removing a folder

    Details

      Description

      As the title says, when i remove an object (a folder, for instance) and then open the content tree, an error is raised and the Content Tree is empty.

      Steps to Reproduce (in prod environement)
      • Create a folder
      • Open the content tree and see that the folder is present (this action is essential for the issue to occur)
      • Remove the created folder
      • Open the content tree again - the tree appears empty

      in firebug, i have the following error:

      	
      404 Not Found
      		414ms	
      CAPI.js (line 1406)
      HeadersResponseJSONCookies
       
      {"ErrorMessage":{"_media-type":"application\/vnd.ez.api.ErrorMessage+json","errorCode":404,"errorMessage"
      :"Not Found","errorDescription":"Could not find 'location' with identifier '64'","trace":"#0 \/var\/www
      \/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Legacy\/Content\/Location
      \/Gateway\/ExceptionConversion.php(59): eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Location\\Gateway
      \\DoctrineDatabase->getBasicNodeData('64')\n#1 \/var\/www\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel
      \/eZ\/Publish\/Core\/Persistence\/Legacy\/Content\/TreeHandler.php(156): eZ\\Publish\\Core\\Persistence
      \\Legacy\\Content\\Location\\Gateway\\ExceptionConversion->getBasicNodeData('64')\n#2 \/var\/www\/ezpublish5
      \/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Legacy\/Content\/Location\/Handler
      .php(111): eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\TreeHandler->loadLocation('64')\n#3 \/var
      \/www\/ezpublish5\/ezpublish\/cache\/prod\/ezpublishProdProjectContainer.php(26248): eZ\\Publish\\Core
      \\Persistence\\Legacy\\Content\\Location\\Handler->load('64')\n#4 \/var\/www\/ezpublish5\/vendor\/ezsystems
      \/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Cache\/LocationHandler.php(32): eZPublishCorePer
      sistenceLegacyContentLocationHandler_0000000015b4a757000000007e4f8263de782a6991dbe2c0bb10911267c3f4a1-
      >load('64')\n#5 \/var\/www\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Repository
      \/LocationService.php(201): eZ\\Publish\\Core\\Persistence\\Cache\\LocationHandler->load('64')\n#6 \
      /var\/www\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/SignalSlot\/LocationService
      .php(103): eZ\\Publish\\Core\\Repository\\LocationService->loadLocation('64')\n#7 \/var\/www\/ezpublish5
      \/ezpublish\/cache\/prod\/ezpublishProdProjectContainer.php(25253): eZ\\Publish\\Core\\SignalSlot\\LocationService-
      >loadLocation('64')\n#8 \/var\/www\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core
      \/REST\/Server\/Controller\/Location.php(134): eZPublishCoreRepositoryLocationService_0000000015b4a461000000007e4f8263de782a6991dbe2c0bb10911267c3f4a1-
      >loadLocation('64')\n#9 [internal function]: eZ\\Publish\\Core\\REST\\Server\\Controller\\Location->loadLocation
      ('1\/2\/64')\n#10 \/var\/www\/ezpublish5\/ezpublish\/bootstrap.php.cache(3109): call_user_func_array
      (Array, Array)\n#11 \/var\/www\/ezpublish5\/ezpublish\/bootstrap.php.cache(3071): Symfony\\Component
      \\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#12 \/var
      \/www\/ezpublish5\/ezpublish\/bootstrap.php.cache(3222): Symfony\\Component\\HttpKernel\\HttpKernel-
      >handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#13 \/var\/www\/ezpublish5\/ezpublish
      \/bootstrap.php.cache(2444): Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel-
      >handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#14 \/var\/www\/ezpublish5\/vendor
      \/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpCache\/HttpCache.php(492): Symfony\\Component
      \\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#15 \/var
      \/www\/ezpublish5\/vendor\/symfony\/symfony\/src\/Symfony\/Bundle\/FrameworkBundle\/HttpCache\/HttpCache
      .php(60): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->forward(Object(Symfony\\Component\\HttpFoundation
      \\Request), true, Object(Symfony\\Component\\HttpFoundation\\Response))\n#16 \/var\/www\/ezpublish5\
      /vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpCache\/HttpCache.php(396): Symfony
      \\Bundle\\FrameworkBundle\\HttpCache\\HttpCache->forward(Object(Symfony\\Component\\HttpFoundation\\Request
      ), true, Object(Symfony\\Component\\HttpFoundation\\Response))\n#17 \/var\/www\/ezpublish5\/vendor\/symfony
      \/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpCache\/HttpCache.php(355): Symfony\\Component\\HttpKernel
      \\HttpCache\\HttpCache->validate(Object(Symfony\\Component\\HttpFoundation\\Request), Object(Symfony
      \\Component\\HttpFoundation\\Response), true)\n#18 \/var\/www\/ezpublish5\/vendor\/symfony\/symfony\
      /src\/Symfony\/Component\/HttpKernel\/HttpCache\/HttpCache.php(213): Symfony\\Component\\HttpKernel\
      \HttpCache\\HttpCache->lookup(Object(Symfony\\Component\\HttpFoundation\\Request), true)\n#19 \/var\
      /www\/ezpublish5\/vendor\/friendsofsymfony\/http-cache-bundle\/SymfonyCache\/EventDispatchingHttpCache
      .php(122): Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache->handle(Object(Symfony\\Component\\HttpFoundation
      \\Request), 1, true)\n#20 \/var\/www\/ezpublish5\/web\/index.php(66): FOS\\HttpCacheBundle\\SymfonyCache
      \\EventDispatchingHttpCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#21 {main}"
      ,"file":"\/var\/www\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence
      \/Legacy\/Content\/Location\/Gateway\/DoctrineDatabase.php","line":86}}
      

      "NetworkError: 404 Not Found - http://ezp5.paulo/api/ezp/v2/content/locations/1/2/64"
      64
      GET http://ezp5.pauloundefined/
      	
      		0ms	
      CAPI.js (line 1406)
      GET http://ezp5.pauloundefined/
      	
      		2ms	
      CAPI.js (line 1406)
      2
      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://ezp5.pauloundefined/. (Reason: CORS request failed).
      

      Could only make the error appear on "prod" environment. The issue do not occur when in "dev" environment.

        Issue Links

          Activity

          Hide
          Mateusz Hyndle (Inactive) added a comment -

          Content tree is rendered basing on REST API call for children, for example /api/ezp/v2/content/locations/1/2/children?offset=0&limit=-1
          In prod env (problem exists only in prod env) result is cached, so after moving content to trash, the result for mentioned REST API call should be purged. It seems that it isn't.
          For moving content to another location (not to the trash) it is working correctly.

          cURL example for gathering children list:

          curl 'http://ez.loc/api/ezp/v2/content/locations/1/2/children?offset=0&limit=-1' \
          -H 'Pragma: no-cache' \
          -H 'Accept-Encoding: gzip, deflate, sdch' \
          -H 'Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4' \
          -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36' \
          -H 'Accept: application/vnd.ez.api.LocationList+json' \
          -H 'Referer: http://ez.loc/ez' \
          -H 'Cookie: eZSESSID=t54ud24q1oj9b7b9d52m8q9bo5' \
          -H 'Connection: keep-alive' \
          -H 'Cache-Control: no-cache' \
          --compressed
          

          It gives following result containing such location:

          {"_media-type":"application\/vnd.ez.api.Location+json","_href":"\/api\/ezp\/v2\/content\/locations\/1\/2\/215"}
          

          After that I'm moving that location to the trash:

          curl 'http://ez.loc/api/ezp/v2/content/locations/1/2/215' \
          -X MOVE \
          -H 'Pragma: no-cache' \
          -H 'Origin: http://ez.loc' -H 'Accept-Encoding: gzip, deflate, sdch' \
          -H 'X-CSRF-Token: bQKC3qjilWmkGiE1aM5hw_4LsSR_zF0q2WDuGbuo5n0' \
          -H 'Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4' \
          -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36' \
          -H 'Content-Type: text/plain;charset=UTF-8' \
          -H 'Accept: */*' \
          -H 'Cache-Control: no-cache' \
          -H 'Referer: http://ez.loc/ez' \
          -H 'Cookie: eZSESSID=t54ud24q1oj9b7b9d52m8q9bo5' \
          -H 'Connection: keep-alive' \
          -H 'Destination: /api/ezp/v2/content/trash' \
          -H 'Content-Length: 0' \
          --compressed
          

          When the first call gathering children is called the removed/moved location still exists.
          After clearing the cache or terminating existing one the removed location is finally not present on the list of children locations.

          Show
          Mateusz Hyndle (Inactive) added a comment - Content tree is rendered basing on REST API call for children, for example /api/ezp/v2/content/locations/1/2/children?offset=0&limit=-1 In prod env (problem exists only in prod env) result is cached, so after moving content to trash, the result for mentioned REST API call should be purged. It seems that it isn't. For moving content to another location (not to the trash) it is working correctly. cURL example for gathering children list: curl 'http://ez.loc/api/ezp/v2/content/locations/1/2/children?offset=0&limit=-1' \ -H 'Pragma: no-cache' \ -H 'Accept-Encoding: gzip, deflate, sdch' \ -H 'Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4' \ -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36' \ -H 'Accept: application/vnd.ez.api.LocationList+json' \ -H 'Referer: http://ez.loc/ez' \ -H 'Cookie: eZSESSID=t54ud24q1oj9b7b9d52m8q9bo5' \ -H 'Connection: keep-alive' \ -H 'Cache-Control: no-cache' \ --compressed It gives following result containing such location: {"_media-type":"application\/vnd.ez.api.Location+json","_href":"\/api\/ezp\/v2\/content\/locations\/1\/2\/215"} After that I'm moving that location to the trash: curl 'http://ez.loc/api/ezp/v2/content/locations/1/2/215' \ -X MOVE \ -H 'Pragma: no-cache' \ -H 'Origin: http://ez.loc' -H 'Accept-Encoding: gzip, deflate, sdch' \ -H 'X-CSRF-Token: bQKC3qjilWmkGiE1aM5hw_4LsSR_zF0q2WDuGbuo5n0' \ -H 'Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4' \ -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36' \ -H 'Content-Type: text/plain;charset=UTF-8' \ -H 'Accept: */*' \ -H 'Cache-Control: no-cache' \ -H 'Referer: http://ez.loc/ez' \ -H 'Cookie: eZSESSID=t54ud24q1oj9b7b9d52m8q9bo5' \ -H 'Connection: keep-alive' \ -H 'Destination: /api/ezp/v2/content/trash' \ -H 'Content-Length: 0' \ --compressed When the first call gathering children is called the removed/moved location still exists. After clearing the cache or terminating existing one the removed location is finally not present on the list of children locations.
          Hide
          Mateusz Hyndle (Inactive) added a comment -
          Show
          Mateusz Hyndle (Inactive) added a comment - ping Bertrand Dunogier
          Hide
          Damien Pobel (Inactive) added a comment -

          @QA: can you retest that now that we have changed the way the tree is build in EZP-24873 ?

          Show
          Damien Pobel (Inactive) added a comment - @QA: can you retest that now that we have changed the way the tree is build in EZP-24873 ?
          Hide
          Paulo Nunes (Inactive) added a comment -

          Seems to be working fine now.
          Tried several actions such as exceeding the content tree size, creating, moving, copying, removing and updating and the content tree responded well

          Show
          Paulo Nunes (Inactive) added a comment - Seems to be working fine now. Tried several actions such as exceeding the content tree size, creating, moving, copying, removing and updating and the content tree responded well
          Hide
          Paulo Nunes (Inactive) added a comment -

          QA Approved

          Show
          Paulo Nunes (Inactive) added a comment - QA Approved

            People

            • Assignee:
              Unassigned
              Reporter:
              Paulo Nunes (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 1 hour
                1d 1h