This issue has been created
There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-e649c549-0df3-4e3d-a363-5bbd77092947 XWIKI-25783 Open

Installing or upgrading an extension fails when an extension is still registered on a wiki that no longer exists

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-95bb5f55-3807-47cc-b80c-1f68e3020ff4 Vincent Massol created this issue on 17/Nov/26 12:14
 
Summary: Installing or upgrading an extension fails when an extension is still registered on a wiki that no longer exists
Issue Type: cid:jira-generated-image-avatar-e649c549-0df3-4e3d-a363-5bbd77092947 Bug
Affects Versions: 17.10.10
Assignee: Unassigned
Components: Extension
Created: 17/Nov/26 12:14
Priority: cid:jira-generated-image-static-major-1792b697-38e7-4f23-b684-a6cd0e6b964c Major
Reporter: Vincent Massol
Description:

Steps to reproduce

  1. Have an extension (e.g. the XWiki Standard flavor) installed on a sub-wiki foo
  2. Make the foo wiki disappear without going through the wiki deletion UI (e.g. restore an older database backup that doesn't contain it, or drop its database schema), so that WikiDeletedEvent is never sent
  3. Install or upgrade an extension whose install plan needs to replace a version installed on wiki:foo (e.g. upgrade the flavor on the main wiki)

Result

The install fails with:

org.xwiki.extension.UninstallException: Uninstall of extension [org.xwiki.platform:xwiki-platform-distribution-flavor-tour/17.10.10] is not allowed
Caused by: org.xwiki.security.authorization.AccessDeniedException: Access denied when checking [admin] access to [Wiki foo] for user [xwiki:XWiki.Admin]
Caused by: org.xwiki.security.authorization.AuthorizationException: Could not retrieve the document to check security access when checking access to [foo:XWiki.XWikiPreferences]
Caused by: com.xpn.xwiki.XWikiException: Error number 2 in 0: No wiki with id [foo] could be found

The extension stays registered on wiki:foo in the installed extension repository (permanent directory), and there is no way from the UI to get rid of that registration: every attempt goes through the same right check on the missing wiki. The only workaround is a script calling InstalledExtensionRepository#uninstallExtension(extension, "wiki:foo") (or editing the .xed files by hand).

Expected

A namespace pointing to a wiki that doesn't exist anymore should not block install/upgrade/uninstall operations. Possible approaches:

  • in AbstractExtensionValidator, don't fail the right check (or skip it) when the namespace is a wiki that doesn't exist
  • and/or detect and clean up namespaces of non-existing wikis (at startup or from the Distribution Wizard), doing what WikiEventListener#onWikiDeleted does on a normal wiki deletion

Reported on the forum: https://forum.xwiki.org/t/multiple-versions-of-extension-after-upgrade/18781

 
 

1 comment

 
cid:jira-generated-image-avatar-95bb5f55-3807-47cc-b80c-1f68e3020ff4 Vincent Massol on 17/Nov/26 12:14
 

Note: this issue has not been reproduced locally ATM. It is based on the stack trace reported on the forum (wiki id and user replaced by foo and XWiki.Admin) and on reading the code (AbstractInstallPlanJob, AbstractExtensionValidator#checkUninstallInternal, WikiEventListener#onWikiDeleted).

Thomas Mortagne could you check if this issue makes sense to you (and which approach you would prefer)? Thanks!