There are 5 updates, 2 comments.
 
 
Wiki Initializer Application / cid:jira-generated-image-avatar-cf0c29e4-3760-411c-a55e-077e1f9a2b7e WKINIT-4 Closed

XWiki fail to start with Postgresql

 
View issue   ·   Add comment
 

5 updates

 
cid:jira-generated-image-avatar-a13ace57-3618-4b31-ac84-b6a0e9a13323 Changes by Clément Aubin on 17/Sep/24 22:25
 
Fix Version: 1.2.0
Documentation in Release Notes: N/A
Documentation: N/A
Resolution: Fixed
Status: Open Closed
 
 

2 comments

 
cid:jira-generated-image-avatar-a13ace57-3618-4b31-ac84-b6a0e9a13323 Clément Aubin on 17/Sep/24 22:22
 

I found the issue, and unfortunately it's not an easy fix …

In order to initialize the main wiki, it's super important that we get to the end of this method : https://github.com/xwiki/xwiki-platform/blob/0fbb9e03ef836606177486f415e019b1933ce8e9/xwiki-platform-core/xwiki-platform-container/xwiki-platform-container-servlet/src/main/java/org/xwiki/container/servlet/XWikiServletContextListener.java#L136 ; in particular, it's important that every event listener that listens to ApplicationStartedEvent get executed before we actually try to fiddle with the main wiki initialization.

If we fail to wait for every event listener to be executed, we may run into WKINIT-3 for example. I initially tried to resolve the problem by explicitly calling event listener multiple times (https://github.com/xwiki-contrib/application-wiki-initializer/commit/dbfb65dea2e4de1dc45c84265fc632ebcb779962), but that ended up doing more harm than good …

So … the current solution from my POV will be to listen to the same ApplicationStartedEvent, and start a job with a 5 seconds delay (configurable) before actually initializing the main wiki. These 5 seconds should give plenty of time for the other event listeners to execute, and so that we have a clean context.

On the long run, it would be super nice to have another way to do this, maybe by having another event fired up, or by being able to prioritize event listeners (have one execute after the other). WDYT Thomas Mortagne ?

 
cid:jira-generated-image-avatar-a13ace57-3618-4b31-ac84-b6a0e9a13323 Clément Aubin on 17/Sep/24 22:26
 

Added a 5 seconds delay by default to initialize the main wiki. This is configurable through the key wikiInitializer.mainWikiInitializationDelay (value should be given in miliseconds)