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

Attachments not persisted when uploaded by xmlrpc or using Document.addAttachment.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 2.5 M1
    • 2.4
    • None
    • Tested with: Oracle JRE 1.6_u21 b07, WinXP 32bit GER, Eclipse 3.6, Intel Core2Duo E8500 CPU, 4GB RAM, primary hard drive is a SSD
    • xmlrpc, api, attachment, bug
    • Integration
    • Hard

    Description

      == Problem ==

      When uploading/storing pages with attachments via XMLRPC API,
      existing attachments from existing pages got lost.
      This effect seems to occur randomly but can be reproduced 100%.

      This is pretty bad, cause nobody expects data lost and will stop us
      from using XWiki in production :-/

      The attachments are deleted from the database and will produce exceptions
      later on. Typical error when trying to touch the attachment:

      {{
      2010-08-10 18:30:57,494 [http://localhost:8080/xwiki/bin/delattachment/Sandbox/Ant/mediawikioriginal.txt?xredirect=%2Fxw
      iki%2Fbin%2Fview%2FSandbox%2FAnt%23Attachments&ajax=1] WARN doc.XWikiAttachment - Failed to load content fo
      r attachment [mediawikioriginal.txt@Sandbox.Ant]. This attachment is broken, please consider re-uploading it. Internal e
      rror: Error number 3231 in 3: Exception while loading attachment mediawikioriginal.txt of document Sandbox.Ant
      Wrapped Exception: No row with the given identifier exists: com.xpn.xwiki.doc.XWikiAttachmentContent#-163312232

      2010-08-10 18:30:57,494 [http://localhost:8080/xwiki/bin/delattachment/Sandbox/Ant/mediawikioriginal.txt?xredirect=%2Fxw
      iki%2Fbin%2Fview%2FSandbox%2FAnt%23Attachments&ajax=1] WARN .XWikiHibernateAttachmentStore - Error loading attachment
      content when deleting attachment mediawikioriginal.txt of doc Sandbox.Ant
      }}

      == Test "Attachments Got Lost" ==
      There is a sample class which you can use to reproduce the problem.
      This test uses the XMLRPC-API and stores pages on a XWiki instance.
      It also attaches one image to each page.
      This test will run ~250 times and thus stores ~250 pages
      with ~250 images. Each image will approximately use 40kBytes within the database.
      Thus the whole database should grow +10MBytes (250*40kB)
      *But when you look into the newly created pages, the attachments are lost!*
      No Exception is thrown no error printed - just lost!

      == Installation/Setup ==

      === Prepare a separate XWiki for this Test ===
      1. Download and unzip "xwiki-enterprise-jetty-hsqldb-2.4.zip"
      1. Start this preconfigured XWiki (start_xwiki.bat)

      === Prepare the Test-Runner ===
      1. Create a new Java Project within your favorite Eclipse workspace
      1. Copy ##MassiveUploadSimulation.java## into the source folder
      1. Download the following JARs (see http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPCJavaExamples)
      1*. commons-logging-1.1.1.jar
      1*. swizzle-confluence-1.2-20080419-xwiki.jar
      1*. ws-commons-util-1.0.2.jar
      1*. xmlrpc-client-3.1.jar
      1*. xmlrpc-common-3.1.jar
      1*. xwiki-core-2.4.jar
      1*. xwiki-core-xml-2.4.jar
      1*. xwiki-core-xmlrpc-client-2.4.jar
      1*. xwiki-core-xmlrpc-model-2.4.jar
      1. Copy the JARs into the project
      1. Register the JARs to your CLASSPATH

      === Run the Test-Runner ===

      1. Run ##MassiveUploadSimulation## as regular 'Java Application'

      warning}}Don't run this simulation on your productive XWiki installation!{{/warning

      === Test It ===
      To see what's wrong, just pick up your browser and open a random page (ex. Page67) and watch for the embedded image. It's lost!

      Attachments

        Issue Links

          Activity

            People

              calebjamesdelisle CalebJamesDeLisle
              mawoki Martin W. Kirst
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: