Fail to upload XAR file for migration

Summary:
I have XARs created by a legacy v8.0 xwiki that will not upload into either the same v8.0 xwiki (stack trace below) or v10.9 (no log output).

Hi there,

I have inherited a legacy xwiki, v8.0 (and using LDAP for users/authors), and I’m trying to migrate it across to a new setup. I’m unfamiliar with xwiki on the backend, and not particularly familiar with tomcat apps.

The problem I have is that when I create a XAR export file, I can’t upload it to either the new (test) server or the legacy server it was made on. I get a red “An error occurred while uploading NAME.xar” message at the bottom in both cases. The XAR file is 8MB without history or 15MB with history. I’ve also tried with/without “backup/author-preserved”

The new version did have a logline complaining about filesize, so I increased max cache size to 200MB and max object cache size to 20MB in context.xml - no more logline complaining about ‘too big for cache’. However, it’s still failing with the same generic red message, and there’s zero logs that I can find about the failure now.

The new setup is:

  • v10.9
  • on a 2GB test VM, but set to max java mem 1024MB (from docs, just for testing)
  • dedicated debian 9 VM
  • openjdk8
  • installed using deb packages
    ** xwiki-common
    ** xwiki-pgsql-common
    ** xwiki-tomcat8-common
    ** xwiki-tomcat8-pgsql
  • not set up with LDAP yet

The legacy version:

  • v8.0
  • been running untouched for years, on ubuntu 14.04
  • don’t know how it was installed, but it’s sitting in /opt
  • has a couple of ‘simple’ users, and the rest are LDAP

The legacy version (v8.0), when I upload the XAR file that it itself made, gives me the following trace in the logs - I don’t know how to interpret this, but it doesn’t seem like it’s related to file size:

2018-11-09 12:41:41,043 [http://xwiki.lkgtools.net/xwiki/bin/upload/XWiki/XWikiPreferences] WARN  c.x.x.w.UploadAction           - Saving uploaded file failed 
com.xpn.xwiki.XWikiException: Error number 3201 in 3: Exception while saving document xwiki:XWiki.XWikiPreferences
	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:659)
	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:167)
	at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:160)
	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1574)
	at com.xpn.xwiki.XWiki.saveDocument(XWiki.java:1508)
	at com.xpn.xwiki.web.UploadAction.uploadAttachment(UploadAction.java:207)
	at com.xpn.xwiki.web.UploadAction.action(UploadAction.java:125)
	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:429)
	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:191)
	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:115)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:127)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:137)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
	at org.eclipse.jetty.server.Server.handle(Server.java:499)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.xpn.xwiki.XWikiException: Error number 3211 in 3: Exception while updating archive XWiki.XWikiPreferences
	at com.xpn.xwiki.store.XWikiHibernateVersioningStore.updateXWikiDocArchive(XWikiHibernateVersioningStore.java:254)
	at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:553)
	... 47 common frames omitted
Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while hibernate execute
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:1305)
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.executeRead(XWikiHibernateBaseStore.java:1338)
	at com.xpn.xwiki.store.XWikiHibernateVersioningStore.loadRCSNodeContent(XWikiHibernateVersioningStore.java:292)
	at com.xpn.xwiki.doc.rcs.XWikiRCSNodeInfo.getContent(XWikiRCSNodeInfo.java:194)
	at com.xpn.xwiki.doc.XWikiDocumentArchive.makePatch(XWikiDocumentArchive.java:137)
	at com.xpn.xwiki.doc.XWikiDocumentArchive.updateArchive(XWikiDocumentArchive.java:253)
	at com.xpn.xwiki.store.XWikiHibernateVersioningStore.updateXWikiDocArchive(XWikiHibernateVersioningStore.java:248)
	... 48 common frames omitted
Caused by: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xpn.xwiki.doc.rcs.XWikiRCSNodeContent#com.xpn.xwiki.doc.rcs.XWikiRCSNodeId@3e982458[docId=6152552094868048244,version=35.1]]
	at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:435)
	at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:233)
	at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
	at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
	at org.hibernate.impl.SessionImpl.load(SessionImpl.java:974)
	at com.xpn.xwiki.store.XWikiHibernateVersioningStore$4.doInHibernate(XWikiHibernateVersioningStore.java:298)
	at com.xpn.xwiki.store.XWikiHibernateVersioningStore$4.doInHibernate(XWikiHibernateVersioningStore.java:293)
	at com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:1299)
	... 54 common frames omitted

So… I’m not sure what’s going on here. I would prefer to change to the psql from mysql, which is why I’m trying the export/import migration path. I suppose I could stick with mysql and try that method of migration

Cheers,

Paul

The error indeed does not seems to have anything to do with the size of the attachment. It’s failing while saving the history of the page which contain the attachment you are trying to upload and suggest that the history if that page is broken for some reason (it actually load the history, modify it and then save it and it fail to load it).

Caused by: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xpn.xwiki.doc.rcs.XWikiRCSNodeContent#com.xpn.xwiki.doc.rcs.XWikiRCSNodeId@3e982458[docId=6152552094868048244,version=35.1]]

According to this line there is an inconsistency in the DB and one entry on the table xwikircs (which contains the version of a document) lost its corresponding xwikirecyclebin entry (which contain the actual patch). The entry seems to be the one with document id 6152552094868048244 and version 35.1. Not really sure what is the best to fix this inconsistency, you might want to try to backup the database and remove that broken xwikircs entry (you might need to restarted if the history is still in the cache) and see if it fix the issue (hoping there is no other like this one).

Thanks for the info, Thomas, I’m back on this in the next couple of days. I’d never have figured that out myself. I’ll try it out shortly.

Okay, thanks Thomas, your suggestion helped. There were actually a few problems happening all at once. The problem on the new server was because I hadn’t opened up the payload size (client_max_body_size) on my nginx reverse proxy. This would be why I wasn’t getting logs of the error on the v10.9 wiki, because it was faulting at the reverse proxy.

Your suggestion re: that database line definitely helped - checking it out, it was related to the previous admin’s import package. Took a db backup, deleted the bad historical package, and did a new export, and now I have an export file that uploads successfully on both v8 and v10 wikis. Unfortunately on the old v8 wiki, I can’t now delete that new import package :slight_smile:

Over on a fresh install of the 10.9 wiki with the nginx chokepoint + tomcat chokepoints opened up, I was now able to upload the new working export package successfully. Now I have extra fun: due to the LDAP setup, neither the admin user created by the initial setup wizard, or the superadmin user can do anything - everything is blocked. None of the LDAP users have admin rights anyway; the old wiki export was done with the superadmin. So now I have a wiki that I have no user to manage with :slight_smile: However, that’s a new, different problem out of scope of my initial question.

Thanks again for the help!