Click
  1. Click
  2. CLK-282

Context is leaking under heavy usage

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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?

        Activity

        Henri Yandell made changes -
        Project Import Fri Mar 20 14:11:32 PDT 2009 [ 1237583492744 ]
        Malcolm Edgar made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Malcolm Edgar made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Bob Schellink made changes -
        Attachment ClickServlet.java.patch [ 10330 ]
        Bob Schellink made changes -
        Field Original Value New Value
        Attachment context-memory-leak.png [ 10320 ]
        Bob Schellink created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development