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

Wiki UI extension parameters aren't thread-safe

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 5.0-milestone-1
    • UI Extension
    • None
    • Unknown

    Description

      Steps to reproduce:

      1. Launch parallel requests to any wiki page, like for i in 1 2; do (while true; do curl http://localhost:8080/xwiki/bin/view/Sandbox/; done)& done

      Expected result:

      No errors are logged.

      Actual result:

      Errors in the form

      2023-09-20 12:08:16,500 [qtp2005169944-74 - http://localhost:8080/xwiki/bin/view/Sandbox/] ERROR o.x.v.t.CollectionTool         - exception encountered while sorting: null
      

      are logged. Possibly (not actually observed), export formats are missing sometimes or don't work.

      Debugging shows that this is while sorting export formats, most likely this line. The reason for the exception is that the "name" attribute of the exporter is null. In fact, all attributes that are derived from parameters are null. The most likely root cause for this seems that sometimes requesting UIX parameters fails because they are currently re-computed by another thread and this is not thread-safe. See the code here - it has a static cache for the parameters and this cache is neither thread-safe nor recomputed in a way that avoids exposing the empty map to another thread. Further, from what I can see, UIXExtension instances are shared between threads.

      Here a screenshot of the debugger paused during the sorting error showing the wrong export entry that causes the exception:

      Attachments

        Activity

          People

            MichaelHamann Michael Hamann
            MichaelHamann Michael Hamann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: