Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-16215

Small wiki pages take forever to render - apparent JSPWiki 2.8.3/2.8.4 performance problem

    Details

    • Epic/Theme:
    • Fix Priority:
      3
    • Liferay Contributor's Agreement:
      Accept

      Description

      When rendering a short but non-trivial wiki page, Liferay appears to hang for minutes at a time. In some cases, the rendering finally completes normally after a long time (at 100% cpu), or sometimes renders a CreoleError and the wiki markup is rendered "raw" (i.e. not parsed and properly turned into formatted HTML).

      During the rendering, generating many stack trace dumps reveals that the JSPWiki CreoleFilter is taking an abnormally long time to render relatively simple pages that contain many links (using [[ ]]) and other link constructs. Removing them and leaving only the basic wiki markup (e.g. headers, bold/italic, etc) makes it render at a "normal" speed (i.e. very fast).

      Attached is an example text file of wiki markup taken from a public Liferay wiki page. The relevant stack trace bits are below. Note the "**" next to the replaceImageArea method. This method appears to be in some kind of tight parsing loop using Java regex libraries. The source to this method can be seen at http://svn.apache.org/repos/asf/incubator/jspwiki/branches/JSPWIKI_2_8_BRANCH/src/com/ecyrd/jspwiki/parser/CreoleToJSPWikiTranslator.java
      (there is also anonymous SVN access to get the full source for debugging purposes).

      java.util.regex.Pattern$Slice.match(Pattern.java:3482)
      java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
      java.util.regex.Pattern$Curly.match1(Pattern.java:3797)
      java.util.regex.Pattern$Curly.match(Pattern.java:3746)
      java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
      java.util.regex.Pattern$Slice.match(Pattern.java:3482)
      java.util.regex.Pattern$Start.match(Pattern.java:3055)
      java.util.regex.Matcher.search(Matcher.java:1105)
      java.util.regex.Matcher.find(Matcher.java:535)

        • com.ecyrd.jspwiki.parser.CreoleToJSPWikiTranslator.replaceImageArea(CreoleToJSPWikiTranslator.java:430)
          com.ecyrd.jspwiki.parser.CreoleToJSPWikiTranslator.translate(CreoleToJSPWikiTranslator.java:251)
          com.ecyrd.jspwiki.filters.CreoleFilter.preTranslate(CreoleFilter.java:93)
          com.liferay.portlet.wiki.engines.jspwiki.filters.CreoleFilter.preTranslate(CreoleFilter.java:63)
          com.ecyrd.jspwiki.filters.FilterManager.doPreTranslateFiltering(FilterManager.java:326)
          com.ecyrd.jspwiki.WikiEngine.textToHTML(WikiEngine.java:1514)
          com.liferay.portlet.wiki.engines.jspwiki.JSPWikiEngine.convert(JSPWikiEngine.java:158)
          com.liferay.portlet.wiki.engines.jspwiki.JSPWikiEngine.convert(JSPWikiEngine.java:65)
          com.liferay.portlet.wiki.util.WikiUtil._convert(WikiUtil.java:412)
          com.liferay.portlet.wiki.util.WikiUtil.convert(WikiUtil.java:78)
          com.liferay.portlet.wiki.util.WikiUtil.diffHtml(WikiUtil.java:91)
          com.liferay.portlet.wiki.service.impl.WikiPageLocalServiceImpl.notifySubscribers(WikiPageLocalServiceImpl.java:1498)
          com.liferay.portlet.wiki.service.impl.WikiPageLocalServiceImpl.updateStatus(WikiPageLocalServiceImpl.java:1324)
          com.liferay.portlet.wiki.service.impl.WikiPageLocalServiceImpl.updateStatus(WikiPageLocalServiceImpl.java:1245)
          sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          java.lang.reflect.Method.invoke(Method.java:597)
          org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)

        Attachments

        1. 2.8.patch
          0.8 kB
        2. Bug.java
          17 kB
        3. JSPWiki.jar
          1019 kB
        4. long-running-thread.txt
          136 kB
        5. test-jspwiki-creole-markup.txt
          8 kB

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 14 weeks, 6 days ago

                Subcomponents