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

Failure to create hundreds of subwikis quickly in succession

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Major
    • None
    • 5.2
    • Old Core
    • None
    • Unknown
    • N/A
    • N/A

    Description

      See http://hole.tuziwo.info/stress-test-xwiki-for-subwikis-creation.html which led me to create this JIRA issue.

      To reproduce:

      • Download the XE standalone distribution (using HSQLDB)
      • Create a page named WikiStressTestCode.FromRequest with the following content:
      {{velocity}}
      #set($wikiName = $!request.getParameter('wikiname'))
      #set($wikiNumber = $!request.getParameter('wikinumber'))
      #set($wikiId = "$!wikiName$!wikiNumber")
      #if($wikiId.isEmpty())
      #set($wikiName = 'Null')
      #set($wikiNumber = 0)
      #set($wikiId = 'null')
      #end
      #if($services.wiki.exists($wikiId))
      #set($wiki = $services.wiki.getById($wikiId))
      #else
      #set($wiki = $services.wiki.createWiki($wikiId, $wikiId, 'xwiki:XWiki.Admin', true))
      #end
      #if($wiki)
      #set($wikiPrettyName = "Wiki $wikiName #$wikiNumber ")
      #set($discard = $wiki.setPrettyName($wikiPrettyName))
      #set($wikiDescription = "Wiki $wikiName #$wikiNumber created for the stress test")
      #set($discard = $wiki.setDescription($wikiDescription))
      #set($discard = $services.wiki.saveDescriptor($wiki))
      #else
      #set($discard = $response.sendError(404, 'Error in creating the wiki'))
      #end
      {{/velocity}}
      
      • Create another page (which can be used to remove all created wikis to try again) named WikiStressTestCode.DeleteWikis:
      {{velocity}}
      #foreach ($i in [1..300])
        #set($discard = $services.wiki.deleteWiki("test${i}"))
      #end
      {{/velocity}}
      
      • Create on the filesystem a file named create-wiki.sh in the directory where you start XWiki:
      #!/bin/bash
      
      NUMBER=1
      NAME=wiki
      if [ $# -ge 1 ]
      then
              NUMBER=$1
      fi
      if [ $# -ge 2 ]
      then
              NAME=$2
      fi
      
      curl \
              --silent \
              --show-error \
              --user Admin:admin \
              -F "wikiname="$NAME \
              -F "wikinumber="$NUMBER \
              -o data/$NAME.html \
              http://localhost:8080/xwiki/bin/view/WikiStressTestCode/FromRequest
      
      • Create a file named stress-test.sh next to it:
      #!/bin/bash
      
      TEST_NUMBER=300
      NAME=test
      LOG_FILE=stress-test-request.log
      if [ -f $LOG_FILE ]
      then
              rm $LOG_FILE
      fi
      if [ $# -ge 1 ]
      then
              TEST_NUMBER=$1
      fi
      
      for num in `seq 1 $TEST_NUMBER`
      do
              echo "Creating wiki "$Name" #$num..."
              ./create-wiki.sh $num $NAME
      done
      
      • Start XE
      • Run stress-test.sh
      • After some point you'll start to see permission errors. It can happen after 15 wikis have been created, after 80 or after 150. For me it happens regularly at around 50-60 wikis.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: