Uploaded image for project: '[Read Only] - Hippo Plugins'
  1. [Read Only] - Hippo Plugins
  2. HIPPLUG-1096

URL Rewriter: Large hiccups and possible OOM during reloading of url rewrite rules

    XMLWordPrintable

Details

    Description

      public void doFilter(final ServletRequest request, final
      ServletResponse response, final FilterChain chain) throws IOException,
      ServletException {
      // check if we loaded from repository, otherwise do nothing
      if (!initialized) {
      synchronized (lock)

      { fetchRules(); }

      }
      // check if we need to reload rules:
      if (needsReloading())

      { fetchRules(); }

      1) problem 1 : If after startup, directly 10 requests hit the site,
      they all get halted on 'synchronized (lock)' ..... but they will ALL
      call fetchRules in the end. Of course the code must be

      if (!initialized) {
      synchronized (lock) {
      if (!initialized)

      { fetchRules(); }

      }
      }

      note, initialized is correctly marked to be volatile.

      2) problem 2 (Serious issue!): After a change in the repository for a
      rewrite rule, needsReloading() returns true. The reload takes long for
      say, more than 1000 rules. Once the model is reloaded,
      needsReloading() returns false. However, every request before the
      model is reloaded, triggers a reload as well. For 20.000 rules, I get
      OOM after minutes. Ouch.

      I will fix issue (1) and (2) in the url rewriter project, and for my
      performance graph, try to be gentle to avoid stampeding herds pulling
      down the entire application

      Another problem is that during (re)building the in memory model, jcr
      events can arrive setting needRefresh = true, which once the model is
      reloaded is again set to needRefresh = false. In other words, events
      that arrive during the building of the model are ignored, resulting in
      possibly missing rules. For this make sure that

      public void invalidate(final Event event)

      { needRefresh = true; }

      becomes synchronized as well, thus

      public synchronized void invalidate(final Event event) { needRefresh = true; }

      Attachments

        Activity

          People

            adouma Ate Douma (Inactive)
            aschrijvers Ard Schrijvers
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: