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
    • Similar Issues:
      Show 5 results 

      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)
      1. 2.8.patch
        0.8 kB
        Jelmer Kuperus
      2. Bug.java
        17 kB
        Jelmer Kuperus
      3. long-running-thread.txt
        136 kB
        Jelmer Kuperus
      4. test-jspwiki-creole-markup.txt
        8 kB
        James Falkner

        Activity

        Hide
        Miguel Ángel Pastor Olivar added a comment -

        Hi,

        In 6.1.X we are using our current Creole parser implementation (based on ANTLR grammar instead using regular expressions). We are not using the JSPWiki creole parser.

        We could introduce this patch as a backport for older version of Liferay.

        Cheers,

        Migue

        Show
        Miguel Ángel Pastor Olivar added a comment - Hi, In 6.1.X we are using our current Creole parser implementation (based on ANTLR grammar instead using regular expressions). We are not using the JSPWiki creole parser. We could introduce this patch as a backport for older version of Liferay. Cheers, Migue
        Hide
        James Falkner added a comment -

        Re-tested on 6.1 GA1 - the issue no longer exists - it renders very fast now.

        Show
        James Falkner added a comment - Re-tested on 6.1 GA1 - the issue no longer exists - it renders very fast now.
        Hide
        James Falkner added a comment -

        Also verified Jelmer's fix on 6.0.6.

        Show
        James Falkner added a comment - Also verified Jelmer's fix on 6.0.6.
        Hide
        James Falkner added a comment -

        And finally.. the fix is also in the more recent versions of JSPWiki, according to https://issues.apache.org/jira/browse/JSPWIKI-688 so a potential patch for Liferay 6.0 is to upgrade to JSPWiki 2.8.5 or 3.0.

        Show
        James Falkner added a comment - And finally.. the fix is also in the more recent versions of JSPWiki, according to https://issues.apache.org/jira/browse/JSPWIKI-688 so a potential patch for Liferay 6.0 is to upgrade to JSPWiki 2.8.5 or 3.0.
        Hide
        Sophia Zhang added a comment -

        PASSED Manual Testing using the following steps:

        Add short but non-trivial wiki page, then try to save to check if it render slowly or not.

        Fixed on:
        Tomcat 7 + MySQL 5. Portal 6.1.x EE GIT ID: b5e90c191c6e804823839080898babcff418e65e.
        Tomcat 7 + MySQL 5. Portal 6.2.x GIT ID: ff3ae0860119f0a06bb05a0b27e5165c5673d387.

        Wiki page renders very fast. No above problems from the description.

        Show
        Sophia Zhang added a comment - PASSED Manual Testing using the following steps: Add short but non-trivial wiki page, then try to save to check if it render slowly or not. Fixed on: Tomcat 7 + MySQL 5. Portal 6.1.x EE GIT ID: b5e90c191c6e804823839080898babcff418e65e. Tomcat 7 + MySQL 5. Portal 6.2.x GIT ID: ff3ae0860119f0a06bb05a0b27e5165c5673d387. Wiki page renders very fast. No above problems from the description.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 24 weeks ago

              Development

                Subcomponents

                  Structure Helper Panel