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

Saving a document with a large object number leads to persistent OOM errors



    • Unit
    • Unknown
    • N/A


      When creating an object with a huge object number, we currently store null entries for all objects numbers that have no object associated. So if you create an object with id 67108863, you get 67108863 null entries. As each null is a 64-bit pointer, this needs 512MiB memory per copy of the document. With a memory limit of 1GiB, this is enough for one copy but not two. Saving thus still works but any code that wants to display the document or a part of it creates a clone which is both slow and ends in an OOM error. Object numbers till close to 2³¹ should be supported given enough memory and thus give a memory usage of up to 16GiB per copy of the document.

      A possible fix seems to be to store the objects in a Map<Integer, BaseObject>, though this might not fix the performance problems unless all code is adjusted to never iterate over the full list of objects.

      Steps to Reproduce:

      1. Create a document
      2. Open the object editor and add an object of any type
      3. Open the web developer tools and change the HTML code:
        1. Change name="YourClass_0_yourProperty" to name="YourClass_67108863_yourProperty" at the input of a property
        2. Add a new hidden input <input type="hidden" name="objectPolicy" value="updateOrCreate" />.
      4. Press save.

      Expected Result

      The document is saved successfully and can be displayed afterwards.

      Actual Result

      While the document is saved to the database, the save action fails with an OOM and afterwards all panes like the navigation or recent changes or other views that involve the document fail with an OOM error. It is also not possible to load the object editor again to remove the object.


        Issue Links



              tmortagne Thomas Mortagne
              MichaelHamann Michael Hamann
              0 Vote for this issue
              2 Start watching this issue