Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0DF59200D2E for ; Tue, 31 Oct 2017 10:03:09 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0C70D1609EB; Tue, 31 Oct 2017 09:03:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 526E31609EC for ; Tue, 31 Oct 2017 10:03:08 +0100 (CET) Received: (qmail 88434 invoked by uid 500); 31 Oct 2017 09:03:07 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 88385 invoked by uid 99); 31 Oct 2017 09:03:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Oct 2017 09:03:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 86EC21A3406 for ; Tue, 31 Oct 2017 09:03:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 96CB3dE9Jow9 for ; Tue, 31 Oct 2017 09:03:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 7201F60F15 for ; Tue, 31 Oct 2017 09:03:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 3DAF7E0E80 for ; Tue, 31 Oct 2017 09:03:03 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 12290212F9 for ; Tue, 31 Oct 2017 09:03:01 +0000 (UTC) Date: Tue, 31 Oct 2017 09:03:01 +0000 (UTC) From: "Dmitri Blinov (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (JEXL-244) Webapp classloader memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 31 Oct 2017 09:03:09 -0000 Dmitri Blinov created JEXL-244: ---------------------------------- Summary: Webapp classloader memory leaks Key: JEXL-244 URL: https://issues.apache.org/jira/browse/JEXL-244 Project: Commons JEXL Issue Type: Bug Affects Versions: 3.1 Environment: Inside J2EE container when Jexl library is included in the deployed .war file Reporter: Dmitri Blinov I have spotted that the following constructions, like for example in JexlEngine.java {code} public static final Object TRY_FAILED = new Object() { @Override public String toString() { return "tryExecute failed"; } }; {code} are not garbage collected when web-app is reloaded and its classloader is released. This is because circular references are created when static class members are initialized with non-static inner/anonymous classes, which are holding implicit references to its enclosing class and thus to its static class type. There are other such examples in JexlEngine.java like {code} protected static final java.lang.ThreadLocal CONTEXT = new java.lang.ThreadLocal() {.. protected static final java.lang.ThreadLocal ENGINE = new java.lang.ThreadLocal() {... {code} The issue is easily resolved if for example the following pattern is followed {code} public static class FailObject extends Object { @Override public String toString() { return "tryExecute failed"; } } public static final Object TRY_FAILED = new FailObject(); {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)