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 7AA04200C63 for ; Wed, 5 Apr 2017 16:32:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7956F160BA3; Wed, 5 Apr 2017 14:32:46 +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 BD2F6160BA6 for ; Wed, 5 Apr 2017 16:32:45 +0200 (CEST) Received: (qmail 39178 invoked by uid 500); 5 Apr 2017 14:32:45 -0000 Mailing-List: contact issues-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list issues@ignite.apache.org Received: (qmail 39157 invoked by uid 99); 5 Apr 2017 14:32:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Apr 2017 14:32:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 8FF61C0994 for ; Wed, 5 Apr 2017 14:32:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-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-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id i7TcPH2pYzPB for ; Wed, 5 Apr 2017 14:32:44 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 9721B5FC90 for ; Wed, 5 Apr 2017 14:32:43 +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 01FA0E06BB for ; Wed, 5 Apr 2017 14:32:43 +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 BD12E263CF for ; Wed, 5 Apr 2017 14:32:41 +0000 (UTC) Date: Wed, 5 Apr 2017 14:32:41 +0000 (UTC) From: "Alexei Scherbakov (JIRA)" To: issues@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (IGNITE-4920) LocalDeploymentSpi resources cleanup on spi.register() might clean resources from other tasks using delegating classloader. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 05 Apr 2017 14:32:46 -0000 Alexei Scherbakov created IGNITE-4920: ----------------------------------------- Summary: LocalDeploymentSpi resources cleanup on spi.register() might clean resources from other tasks using delegating classloader. Key: IGNITE-4920 URL: https://issues.apache.org/jira/browse/IGNITE-4920 Project: Ignite Issue Type: Bug Components: general Affects Versions: 1.6 Reporter: Alexei Scherbakov Assignee: Alexei Scherbakov Fix For: 2.1 Culrpit is "if" condition in LocalDelpoymentSpi: {noformat} if (entry.getKey().equals(entry.getValue()) && isResourceExist(ldr, entry.getKey()) && !U.hasParent(clsLdrToIgnore, ldr) && ldrRsrcs.remove(ldr, clsLdrRsrcs)) { ... } {noformat} and can be fixed by adding clsLdrRsrcs.containsKey(entry.getKey()): {noformat} if (entry.getKey().equals(entry.getValue()) && isResourceExist(ldr, entry.getKey()) && !U.hasParent(clsLdrToIgnore, ldr) && clsLdrRsrcs.containsKey(entry.getKey()) && ldrRsrcs.remove(ldr, clsLdrRsrcs)) { ... } {noformat} Reproducer (might require multiple runs) {noformat} /** */ public class Main { public static void main(String args[]) throws MalformedURLException, ClassNotFoundException { System.setProperty("IGNITE_CACHE_REMOVED_ENTRIES_TTL", "1"); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setPeerClassLoadingEnabled(true); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(spi); final Ignite ignite = Ignition.start(cfg); final ClassLoader moduleClsLdr = Main.class.getClassLoader(); final ClassLoader moduleCLImpl = new DelegateClassLoader(null, moduleClsLdr); for (int i = 0; i < 1000000; i++) try { Class clazz = moduleCLImpl.loadClass("Main$CallFunction"); ignite.compute().call( (IgniteCallable)clazz.getDeclaredConstructor(ClassLoader.class).newInstance(moduleCLImpl) ); } catch (Exception e) { e.printStackTrace(); } System.out.println("Done"); } public static class CallFunction implements IgniteCallable, GridPeerDeployAware { transient ClassLoader classLoader; public CallFunction(ClassLoader cls) { this.classLoader = cls; } public Object call() throws Exception { return null; } public Class deployClass() { return this.getClass(); } public ClassLoader classLoader() { return classLoader; } } public static class DelegateClassLoader extends ClassLoader { private ClassLoader delegateCL; public DelegateClassLoader(ClassLoader parent, ClassLoader delegateCL) { super(parent); // Parent doesn't matter. this.delegateCL = delegateCL; } @Override public URL getResource(String name) { return delegateCL.getResource(name); } @Override public Class loadClass(String name) throws ClassNotFoundException { return delegateCL.loadClass(name); } } } {noformat} -- This message was sent by Atlassian JIRA (v6.3.15#6346)