Uploaded image for project: 'Click'
  1. Click
  2. CLK-282

Context is leaking under heavy usage

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:
      Click 1.4RC2

      Description

      Attached is the profiler output after 10 000 requests. A number of garbage collections was run so the JVM can reclaim memory. Notice the in the difference column that Context and ClickRequestWrapper increased by 38 instances.

      The profiler also indicated that Context is referenced by ThreadLocal variable.

      By explicitly nullifying the ThreadLocal Context is bound to removes the leak.

      protected void handleRequest(...) {
      try

      { .... }

      finally

      { ... Context.setThreadLocalContext(null); }

      }

      PS: I vaguely remember handleRequest did nullify the ThreadLocal. If so what was the reason for taking it out? Only reason I can think of is if there are Filters needing access to the Context after handleRequest returned?

        Attachments

          Activity

            People

            • Assignee:
              medgar Malcolm Edgar
              Reporter:
              sabob Bob Schellink
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: