ICEfaces
  1. ICEfaces
  2. ICE-3368

Synchronized Parser can hold up the entire application

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.1
    • Fix Version/s: 1.8DR#1, 1.8
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Any

      Description

      According to the forum entry, clients accessing an application from a slower site can impact the performance of clients accessing an application from a faster location. This looks to be due to blocking in the Parser code. It's related to sychronization that was added to fix another issue, ICE-2936

      The Parser is not re-entrantly threadsafe as an application scoped instance, so the parse method has to be synchronized. It can't be made session-scoped because the parser is 140K/user. And it can't be request scoped because it takes 2+ seconds to load the tag rules each time the parser is initialized which is added to the render time.

      That's the source of the inter-thread blocking.

      We may have to load the tag rules statically in the constructor and then construct a per-request instance of the parser. This will require a little bit of breakage, because the parser is a member variable of the ViewHandler, which is an application scoped entity.

        Activity

        Hide
        Deryk Sinotte added a comment -

        The parse() method of com.icesoft.faces.webapp.parser.Parser is currently synchronized at the method level to prevent the threading issues described in the previous case. One solution may be to make the synchronization more granular. Ted made a quick test and this seemed work without side effects.

        synchronized(this)

        { digester.clear(); digester.push(rootTag); digester.push(rootWire); digester.parse(page); }
        Show
        Deryk Sinotte added a comment - The parse() method of com.icesoft.faces.webapp.parser.Parser is currently synchronized at the method level to prevent the threading issues described in the previous case. One solution may be to make the synchronization more granular. Ted made a quick test and this seemed work without side effects. synchronized(this) { digester.clear(); digester.push(rootTag); digester.push(rootWire); digester.parse(page); }
        Hide
        Deryk Sinotte added a comment -

        Assigning to Greg

        Show
        Deryk Sinotte added a comment - Assigning to Greg
        Hide
        Deryk Sinotte added a comment -

        The forum poster has noted that the suggested change worked for them.

        http://www.icefaces.org/JForum/posts/list/9276.page#39283

        Ted later suggested a more comprehensive change based on comments from Greg:

        TagWire realViewWire = null;
        String viewTagClassName = null;
        synchronized(this)

        { digester.clear(); digester.push(rootTag); digester.push(rootWire); digester.parse(page); realViewWire = digester.getViewWire(); viewTagClassName = digester.getViewTagClassName(); }
        Show
        Deryk Sinotte added a comment - The forum poster has noted that the suggested change worked for them. http://www.icefaces.org/JForum/posts/list/9276.page#39283 Ted later suggested a more comprehensive change based on comments from Greg: TagWire realViewWire = null; String viewTagClassName = null; synchronized(this) { digester.clear(); digester.push(rootTag); digester.push(rootWire); digester.parse(page); realViewWire = digester.getViewWire(); viewTagClassName = digester.getViewTagClassName(); }

          People

          • Assignee:
            Unassigned
            Reporter:
            Deryk Sinotte
          • Votes:
            5 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: