This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-eb980dd6-2f44-4f4f-a85c-c47fe6e417ca XWIKI-23642 Open

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

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-8fdd7fdf-d748-49f4-93e7-f63482918da2 Raluca Stavro created this issue on 29/Oct/25 11:53
 
Summary: When a document is deleted and the automatic redirect is enabled, DocumentCreatedEvent is fired before DocumentDeletedEvent
Issue Type: cid:jira-generated-image-avatar-eb980dd6-2f44-4f4f-a85c-c47fe6e417ca Bug
Affects Versions: 14.10.20
Assignee: Unassigned
Created: 29/Oct/25 11:53
Priority: cid:jira-generated-image-static-major-a520d826-a4d8-4f32-8b7e-2d4db1ac888b Major
Reporter: Raluca Stavro
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
 
 

1 update

 
cid:jira-generated-image-avatar-55172db3-2782-48fa-85cc-476c1963a86b Changes by Thomas Mortagne on 29/Oct/25 11:54
 
Summary: When a document is deleted and the automatic redirect is enabled, DocumentCreatedEvent is fired received before DocumentDeletedEvent