Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-23642

When a document is deleted and the automatic redirect is enabled, DocumentCreatedEvent is received before DocumentDeletedEvent

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 14.10.20
    • None
    • None
    • Unknown

    Description

      I noticed this issue while investigating why redirects to not get replicated to other instances. The events caught by the replication listener are in the following order : 

      1. Stack from catching the first event :

      Daemon Thread \[refactoring/wiki/a40a9c57-b3d5-11f0-91ce-a1260d8262d5/WebHome job group daemon thread - org.xwiki.refactoring.internal.job.DeleteJob@417e05e6(\[refactoring, delete, 1761675608846-914\])\] (Suspended (breakpoint at line 91 in DocumentReplicationListener))    
      DocumentReplicationListener.onEvent(Event, Object, Object) line: 91    
      DefaultObservationManager.notify(Collection\<RegisteredListener>, Event, Object, Object) line: 320    
      DefaultObservationManager.notify(Event, Object, Object) line: 285    
      XWiki.afterSave(XWikiDocument, XWikiContext) line: 2033    
      XWiki.saveDocument(XWikiDocument, String, boolean, XWikiContext) line: 2123    
      XWiki.saveDocument(XWikiDocument, String, XWikiContext) line: 2001    
      DefaultModelBridge.createRedirect(DocumentReference, DocumentReference) line: 254    
      AutomaticRedirectCreatorListener.processLocalEvent(Event, Object, Object) line: 99    
      AutomaticRedirectCreatorListener(AbstractLocalEventListener).onEvent(Event, Object, Object) line: 87    
      DefaultObservationManager.notify(Collection\<RegisteredListener>, Event, Object, Object) line: 320    
      DefaultObservationManager.notify(Event, Object, Object) line: 285    
      XWiki.afterDelete(XWikiDocument, XWikiContext) line: 4602    
      XWiki.deleteDocument(XWikiDocument, boolean, boolean, XWikiContext) line: 4639    
      XWiki.deleteDocument(XWikiDocument, boolean, XWikiContext) line: 4554    
      XWiki.lambda$deleteAllDocuments$1(XWikiDocument, XWikiContext, boolean) line: 6912    
      1506542395.execute() line: not available    
      DefaultBatchOperationExecutor.execute(BatchOperation\<E>, String) line: 76    
      DefaultBatchOperationExecutor.execute(BatchOperation\<E>) line: 54    
      XWiki.deleteAllDocuments(XWikiDocument, boolean, XWikiContext) line: 6904    
      DefaultModelBridge.delete(DocumentReference, boolean) line: 207    
      DefaultModelBridge.delete(DocumentReference) line: 193    
      DeleteJob.maybeDelete(DocumentReference) line: 152    
      DeleteJob.process(DocumentReference) line: 115    
      DeleteJob.process(EntityReference) line: 97    
      DeleteJob(AbstractEntityJob\<R,S>).process(Collection\<EntityReference>) line: 225    
      DeleteJob.lambda$process$0(Collection) line: 86    
      1029963810.execute() line: not available    
      DefaultBatchOperationExecutor.execute(BatchOperation\<E>, String) line: 76    
      DefaultBatchOperationExecutor.execute(BatchOperation\<E>) line: 54    
      DeleteJob.process(Collection\<EntityReference>) line: 86    
      DeleteJob(AbstractEntityJobWithChecks\<R,S>).runInternal() line: 66    
      DeleteJob(AbstractJob\<R,S>).runInContext() line: 246    
      DeleteJob(AbstractJob\<R,S>).run() line: 223    
      DefaultJobExecutor$JobGroupExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1128    
      ThreadPoolExecutor$Worker.run() line: 628    
      Thread.run() line: 829
      • this time, the event is of type org.xwiki.bridge.event.DocumentCreatedEvent

      2. Stack from catching the second event :

      Daemon Thread [refactoring/wiki/a40a9c57-b3d5-11f0-91ce-a1260d8262d5/WebHome job group daemon thread - org.xwiki.refactoring.internal.job.DeleteJob@417e05e6([refactoring, delete, 1761675608846-914])] (Suspended (breakpoint at line 91 in DocumentReplicationListener))    
          DocumentReplicationListener.onEvent(Event, Object, Object) line: 91    
          DefaultObservationManager.notify(Collection<RegisteredListener>, Event, Object, Object) line: 320    
          DefaultObservationManager.notify(Event, Object, Object) line: 285    
          XWiki.afterDelete(XWikiDocument, XWikiContext) line: 4602    
          XWiki.deleteDocument(XWikiDocument, boolean, boolean, XWikiContext) line: 4639    
          XWiki.deleteDocument(XWikiDocument, boolean, XWikiContext) line: 4554    
          XWiki.lambda$deleteAllDocuments$1(XWikiDocument, XWikiContext, boolean) line: 6912    
          1506542395.execute() line: not available    
          DefaultBatchOperationExecutor.execute(BatchOperation<E>, String) line: 76    
          DefaultBatchOperationExecutor.execute(BatchOperation<E>) line: 54    
          XWiki.deleteAllDocuments(XWikiDocument, boolean, XWikiContext) line: 6904    
          DefaultModelBridge.delete(DocumentReference, boolean) line: 207    
          DefaultModelBridge.delete(DocumentReference) line: 193    
          DeleteJob.maybeDelete(DocumentReference) line: 152    
          DeleteJob.process(DocumentReference) line: 115    
          DeleteJob.process(EntityReference) line: 97    
          DeleteJob(AbstractEntityJob<R,S>).process(Collection<EntityReference>) line: 225    
          DeleteJob.lambda$process$0(Collection) line: 86    
          1029963810.execute() line: not available    
          DefaultBatchOperationExecutor.execute(BatchOperation<E>, String) line: 76    
          DefaultBatchOperationExecutor.execute(BatchOperation<E>) line: 54    
          DeleteJob.process(Collection<EntityReference>) line: 86    
          DeleteJob(AbstractEntityJobWithChecks<R,S>).runInternal() line: 66    
          DeleteJob(AbstractJob<R,S>).runInContext() line: 246    
          DeleteJob(AbstractJob<R,S>).run() line: 223    
          DefaultJobExecutor$JobGroupExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1128    
          ThreadPoolExecutor$Worker.run() line: 628    
          Thread.run() line: 829
      • this time, the event is of type org.xwiki.bridge.event.DocumentDeletedEvent

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            ralucamorosan Raluca Stavro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: