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

Possible failing new mandatory document saved on subwiki

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    Description

      When the subwiki is initialized, mandatory documents get saved and to save that document the store needs to access the document syntax.

      Problem is that most of the time a new XWikiDocument does not have any explicit syntax value, so when getSyntax is called it trying to get the default syntax from the preferences. If the default syntax is not already cached, it's going to try to find it in the main wiki preferences, but being already in a database session it's not allowed to access a different wiki, and it fails.

      com.xpn.xwiki.XWikiException: Error number 3202 in 3: Exception while reading document [xwiki:***.WebPreferences()]
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:1157)
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:395)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2164)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:2226)
              at org.xwiki.configuration.internal.AbstractXWikiPreferencesConfigurationSource.getBaseObject(AbstractXWikiPreferencesConfigurationSource.java:86)
              at org.xwiki.configuration.internal.AbstractXWikiPreferencesConfigurationSource.getBaseProperty(AbstractXWikiPreferencesConfigurationSource.java:139)
              at org.xwiki.configuration.internal.AbstractXWikiPreferencesConfigurationSource.getBaseProperty(AbstractXWikiPreferencesConfigurationSource.java:156)
              at org.xwiki.configuration.internal.AbstractDocumentConfigurationSource.getPropertyValue(AbstractDocumentConfigurationSource.java:348)
              at org.xwiki.configuration.internal.AbstractDocumentConfigurationSource.containsKey(AbstractDocumentConfigurationSource.java:203)
              at org.xwiki.configuration.internal.AbstractSpacesConfigurationSource$SpaceConfigurationSource.containsKey(AbstractSpacesConfigurationSource.java:171)
              at org.xwiki.configuration.internal.AbstractCompositeConfigurationSource.containsKey(AbstractCompositeConfigurationSource.java:45)
              at org.xwiki.configuration.internal.AbstractCompositeConfigurationSource.containsKey(AbstractCompositeConfigurationSource.java:45)
              at org.xwiki.configuration.internal.AbstractCompositeConfigurationSource.getProperty(AbstractCompositeConfigurationSource.java:75)
              at com.xpn.xwiki.internal.DefaultCoreConfiguration.getDefaultDocumentSyntax(DefaultCoreConfiguration.java:85)
              at com.xpn.xwiki.doc.XWikiDocument.getDefaultDocumentSyntax(XWikiDocument.java:9160)
              at com.xpn.xwiki.doc.XWikiDocument.getSyntax(XWikiDocument.java:7630)
              at com.xpn.xwiki.internal.filter.input.XWikiDocumentLocaleEventGenerator.writeRevision(XWikiDocumentLocaleEventGenerator.java:184)
              at com.xpn.xwiki.internal.filter.input.XWikiDocumentLocaleEventGenerator.write(XWikiDocumentLocaleEventGenerator.java:154)
              at com.xpn.xwiki.internal.filter.input.XWikiDocumentLocaleEventGenerator.write(XWikiDocumentLocaleEventGenerator.java:62)
              at org.xwiki.filter.instance.internal.input.AbstractBeanEntityEventGenerator.write(AbstractBeanEntityEventGenerator.java:131)
              at com.xpn.xwiki.internal.filter.XWikiDocumentFilterUtils.exportEntity(XWikiDocumentFilterUtils.java:334)
              at com.xpn.xwiki.doc.XWikiDocument.toXML(XWikiDocument.java:5182)
              at com.xpn.xwiki.doc.XWikiDocument.toXML(XWikiDocument.java:5167)
              at com.xpn.xwiki.doc.XWikiDocument.toXML(XWikiDocument.java:5039)
              at com.xpn.xwiki.doc.XWikiDocument.toXML(XWikiDocument.java:4937)
              at com.xpn.xwiki.doc.rcs.XWikiPatch.setFullVersion(XWikiPatch.java:131)
              at com.xpn.xwiki.doc.XWikiDocumentArchive.makePatch(XWikiDocumentArchive.java:152)
              at com.xpn.xwiki.doc.XWikiDocumentArchive.updateArchive(XWikiDocumentArchive.java:289)
              at com.xpn.xwiki.store.XWikiHibernateVersioningStore.updateXWikiDocArchive(XWikiHibernateVersioningStore.java:276)
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:631)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:259)
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:219)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:2076)
              at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1981)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocument(XWiki.java:1442)
              at com.xpn.xwiki.XWiki.initializeMandatoryDocuments(XWiki.java:1406)
              at com.xpn.xwiki.internal.WikiInitializerJob.runInternal(WikiInitializerJob.java:108)
              at org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:243)
              at org.xwiki.job.AbstractJob.run(AbstractJob.java:220)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
              at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: com.xpn.xwiki.XWikiException: Error number 3301 in 3: Cannot switch to database xwiki in an existing session
              at com.xpn.xwiki.internal.store.hibernate.HibernateStore.beginTransaction(HibernateStore.java:820)
              at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:576)
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:1024)
              ... 41 common frames omitted
      

      This check for wrong cross wiki manipulation during an already open database session was added in 14.4 and 13.10.6 (XWIKI-19730).

      Fortunately the main wiki default syntax is very often already in cache when initializing a subwiki so restarting XWiki and making sure to access the main wiki first is often enough as a workaround when this happens.

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            tmortagne Thomas Mortagne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: