Details

      Description

      When removing content I get the exception "Could not find 'Content' with identifier '[ID]'". The problem seems to be that SignalSlot/ContentService.php deleteContent() first deletes the content, and then emits a DeleteContentSignal:
      https://github.com/ezsystems/ezpublish-kernel/blob/3ab82f6adc9441b2ccf11bd21c00509f423d7c28/eZ/Publish/Core/SignalSlot/ContentService.php#L289

      Later on, when this signal is received, HTTP cache is purged, and in the process ContentService::loadContentInfo() is called:
      https://github.com/ezsystems/ezpublish-kernel/blob/3ab82f6adc9441b2ccf11bd21c00509f423d7c28/eZ/Publish/Core/MVC/Symfony/Cache/Http/InstantCachePurger.php#L69

      But at this point the content no longer exists.

        Issue Links

          Activity

          Hide
          Gunnstein Lye added a comment - - edited

          To resolve, we could maybe move this deleteContent call to after the DeleteContentSignal is emitted:
          https://github.com/ezsystems/ezpublish-kernel/blob/3ab82f6adc9441b2ccf11bd21c00509f423d7c28/eZ/Publish/Core/SignalSlot/ContentService.php#L291

          Naive, optimistic PR: https://github.com/ezsystems/ezpublish-kernel/pull/1352
          Edit: PR closed, see discussion there. TL; DR: This is tricky.

          Show
          Gunnstein Lye added a comment - - edited To resolve, we could maybe move this deleteContent call to after the DeleteContentSignal is emitted: https://github.com/ezsystems/ezpublish-kernel/blob/3ab82f6adc9441b2ccf11bd21c00509f423d7c28/eZ/Publish/Core/SignalSlot/ContentService.php#L291 Naive, optimistic PR: https://github.com/ezsystems/ezpublish-kernel/pull/1352 Edit: PR closed, see discussion there. TL; DR: This is tricky.
          Hide
          Jérôme Vieilledent (Inactive) added a comment -

          OK, so issue is that when the DeleteSignal is sent, content (and thus relation/locations...) have already been removed, so we cannot access to affected locationIds.

          Idea to fix it is the following:

          1. Define a new locationId collector interface, in SignalSlot namespace (finding a name will be fun :-P)
          2. Implement this new interface in MVC namespace and define it as a service. This new service would reuse what's currently done in InstantCachePurger (collecting using Symfony event dispatcher)
          3. Inject this new service in SignalSlot Repository / ContentService (to be used in deleteContent())
          4. InstantCachePurger will use this new collector service for collecting locationIds instead of doing it directly
          5. Add a new purgeForLocations() method in GatewayCachePurger interface (or undeprecate purge()), in order to allow HttpCache purging by locationIds
          6. DeleteContentSlot would use purgeForLocations() instead of purgeForContent(), as we'll pass it an array of locationIds affected by the content deletion.
          Show
          Jérôme Vieilledent (Inactive) added a comment - OK, so issue is that when the DeleteSignal is sent, content (and thus relation/locations...) have already been removed, so we cannot access to affected locationIds. Idea to fix it is the following: Define a new locationId collector interface, in SignalSlot namespace (finding a name will be fun :-P) Implement this new interface in MVC namespace and define it as a service. This new service would reuse what's currently done in InstantCachePurger (collecting using Symfony event dispatcher) Inject this new service in SignalSlot Repository / ContentService (to be used in deleteContent()) InstantCachePurger will use this new collector service for collecting locationIds instead of doing it directly Add a new purgeForLocations() method in GatewayCachePurger interface (or undeprecate purge() ), in order to allow HttpCache purging by locationIds DeleteContentSlot would use purgeForLocations() instead of purgeForContent() , as we'll pass it an array of locationIds affected by the content deletion.
          Hide
          Gunnstein Lye added a comment -

          AFAIK it should work, as long as none of the affected code is going to try to load the locations from db.

          It's tempting to suggest a "death row" state for content. Deletion would first set this state, which means the content will disappear from UI, no new cache will be built, etc. Then we can take our time to purge cache, clean up relations etc, and finally delete the content. Asynchronously if needed. (May be overkill, just thinking loudly here.)

          Show
          Gunnstein Lye added a comment - AFAIK it should work, as long as none of the affected code is going to try to load the locations from db. It's tempting to suggest a "death row" state for content. Deletion would first set this state, which means the content will disappear from UI, no new cache will be built, etc. Then we can take our time to purge cache, clean up relations etc, and finally delete the content. Asynchronously if needed. (May be overkill, just thinking loudly here.)
          Hide
          Peter Halasz added a comment -

          Hello,

          I ran into this issue on a cli command on latest eZ Platform and eZ Studio install. Is there a timeline on when this will be fixed?

          Show
          Peter Halasz added a comment - Hello, I ran into this issue on a cli command on latest eZ Platform and eZ Studio install. Is there a timeline on when this will be fixed?
          Hide
          Gunnstein Lye added a comment -

          Ping André Rømcke Bertrand Dunogier, as mentioned in todays meeting.

          Show
          Gunnstein Lye added a comment - Ping André Rømcke Bertrand Dunogier , as mentioned in todays meeting.
          Hide
          André Rømcke added a comment - - edited

          A intermediate solution to at least fix the NotFound exceptions where proposed in: https://github.com/ezsystems/ezpublish-kernel/pull/1635#issuecomment-212022529

          This would also take care about clearing cache for the location itself, however not yet parent, or children, or children of children (as these are tree operations).

          Show
          André Rømcke added a comment - - edited A intermediate solution to at least fix the NotFound exceptions where proposed in: https://github.com/ezsystems/ezpublish-kernel/pull/1635#issuecomment-212022529 This would also take care about clearing cache for the location itself, however not yet parent, or children, or children of children (as these are tree operations) .
          Hide
          André Rømcke added a comment -

          Status update

          This issue has been fixed as part of EZP-25003, however the fix clears all content http cache when deleting content (but cache clearing is somewhat more precise when deleting/trashing/restoring locations). More precise cache clearing also on Content deletion is pending feature EZP-25696 currently being looked into.

          Show
          André Rømcke added a comment - Status update This issue has been fixed as part of EZP-25003 , however the fix clears all content http cache when deleting content (but cache clearing is somewhat more precise when deleting/trashing/restoring locations) . More precise cache clearing also on Content deletion is pending feature EZP-25696 currently being looked into.
          Hide
          André Rømcke added a comment -

          Duplicates EZP-25003 (delete content case was handled there also)

          Show
          André Rømcke added a comment - Duplicates EZP-25003 (delete content case was handled there also)

            People

            • Assignee:
              Unassigned
              Reporter:
              Gunnstein Lye
            • Votes:
              1 Vote for this issue
              Watchers:
              5 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 - 4 hours, 30 minutes
                4h 30m