Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C51D18C13 for ; Wed, 3 Feb 2016 20:22:41 +0000 (UTC) Received: (qmail 23824 invoked by uid 500); 3 Feb 2016 20:22:38 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 23779 invoked by uid 500); 3 Feb 2016 20:22:37 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 23762 invoked by uid 99); 3 Feb 2016 20:22:37 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2016 20:22:37 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 37329C03E9 for ; Wed, 3 Feb 2016 20:22:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.298 X-Spam-Level: * X-Spam-Status: No, score=1.298 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=invoke-com.20150623.gappssmtp.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Oex-KftRmRUi for ; Wed, 3 Feb 2016 20:22:32 +0000 (UTC) Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id E18BF207E1 for ; Wed, 3 Feb 2016 20:22:31 +0000 (UTC) Received: by mail-io0-f170.google.com with SMTP id 9so69590384iom.1 for ; Wed, 03 Feb 2016 12:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invoke-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=+f0/vzSN1eHMBKsyg5iBfEdqKCVP/dyH/Wprz2/bcSM=; b=JLvYy9NJAYeIp5J6axumDCdIwAjm2LM+Iv0F/cQW9t5Ck51tob9PeUCErS2KjQkwVQ H1AFdWKbKw6KkJiqEZWkv0z7v2coaVvjzFmjH/M6kvAEMxXS05tr6YMamBrsg5ta9jz9 EDZBGze0mazuumXfUwNTxnl/5vKnxDjCgr7nlUTan4JfMfXLV6dBGOSzkIntxnFu19BN H0uFwJWF/SkChq3tqYHpmFhNc106UKcF0+Et+/tLJFUIixG/Lq/WpWpeqpKqkaRh/LdM ir0OvS+LGY1ZM096izwxt3myikal08CZ30GgRwYvWgEa8DnpYDqAJGecblCFtuWn4K/Z clcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=+f0/vzSN1eHMBKsyg5iBfEdqKCVP/dyH/Wprz2/bcSM=; b=fYyLn8hRptEE5s6GmuTc9zW+j4bLtNZSZFVOmb7pAZSZZr+T16Go1wlmyqN4umwXET H51opDpC0jQyRZJzEw3V/HtixKzfUibWtvrLC1aBK/vrjjdefjJZ5mGc+mSJQZ2nFNMi HBj66zqXrKiH4HzrR7Miv+Ce0/59cPBhyKt6ehmElIlapgYXF4eSxy+Z3t7bPaJ8/w58 3jf1b9gBDYG9XGvf0Ymo+NV7BeqcbtEn9Olh4I6goligBxQTxbj+3/57rwwmGXFRr+eG fRNpHfdmjMEAPgmRN9hYBEKDBe1NPEktUQeYKxbm0NH9yY+KdVZZiEojKa1dgkyzCuRO IUDQ== X-Gm-Message-State: AG10YORlnE0IRcoObclygH2slA5uPYUsb0fKhK+7rht8vid637niC9x/7jfmfwIwYHoPzx7YFUiB0SOrAl7onOWh MIME-Version: 1.0 X-Received: by 10.107.18.101 with SMTP id a98mr5214017ioj.181.1454530951244; Wed, 03 Feb 2016 12:22:31 -0800 (PST) Received: by 10.36.121.198 with HTTP; Wed, 3 Feb 2016 12:22:31 -0800 (PST) In-Reply-To: References: <1454440869.6614.0.camel@apache.org> <1454442690.6614.6.camel@apache.org> <1454443907.6614.10.camel@apache.org> <1454444503.6614.18.camel@apache.org> <1454445375.6614.27.camel@apache.org> Date: Wed, 3 Feb 2016 15:22:31 -0500 Message-ID: Subject: Re: HttpClientBuilder Memory Leak From: Dan Quaroni To: HttpClient User Discussion Content-Type: multipart/alternative; boundary=001a113f5facaa28ec052ae3607d --001a113f5facaa28ec052ae3607d Content-Type: text/plain; charset=UTF-8 David, can you try profiling it using visualvm and see if you can reproduce the results? On Wed, Feb 3, 2016 at 3:06 PM, David Skalka wrote: > Sorry for delay. > > java varsion is 1.8.0. 66-b17. The graph was made by Jprofiler. > > I tested same code with Yourkit a Jconsole wihout any leak. I dont > understand it. > > Can someone profile this code using JProfiler? It looks at the serious > errors of JProfiler > > > 2016-02-02 23:15 GMT+01:00 Gary Gregory : > > > Curious: What profiler and java version are you using? > > > > Gary > > > > On Tue, Feb 2, 2016 at 1:39 PM, David Skalka > > wrote: > > > > > I updated httpclient to 4.5.1 and after 30minutes I see same result. > > > memory is growing up > > > > > > 2016-02-02 21:51 GMT+01:00 Dan Quaroni : > > > > > > > I don't really know what program is producing this image, but what I > > see > > > in > > > > this picture is that there are a lot of Strings in memory, which seem > > to > > > be > > > > living in HashMap(s). I don't know how this program he used analyzes > > > > memory usage... But either way, I can't reproduce it. > > > > > > > > On Tue, Feb 2, 2016 at 3:36 PM, Oleg Kalnichevski > > > > wrote: > > > > > > > > > On Tue, 2016-02-02 at 15:29 -0500, Dan Quaroni wrote: > > > > > > What version of HttpClient are you using? I cut the sleep down > to > > > 1ms > > > > > and > > > > > > have had it running for 25 minutes and am not observing any such > > > memory > > > > > > leak. > > > > > > > > > > > > > > > > If one takes even a cursory look at the memory profile one can > > clearly > > > > > see that out several dozen classes on the heap only one class > belongs > > > to > > > > > HttpCient - CPool and there are only ~900 instances of that class > > > > > compared to millions of instances of other classes. > > > > > > > > > > Oleg > > > > > > > > > > > On Tue, Feb 2, 2016 at 3:21 PM, Oleg Kalnichevski < > > olegk@apache.org> > > > > > wrote: > > > > > > > > > > > > > On Tue, 2016-02-02 at 21:16 +0100, David Skalka wrote: > > > > > > > > what is it "own data" ? > > > > > > > > > > > > > > > > > > > > > > https://drive.google.com/open?id=0B8cERbS5JTTtZkVpWmhVWS11UkU > > > > > > > > > > > > > > Oleg > > > > > > > > > > > > > > > > > > > > > > 2016-02-02 21:11 GMT+01:00 Oleg Kalnichevski < > olegk@apache.org > > >: > > > > > > > > > > > > > > > > > On Tue, 2016-02-02 at 20:58 +0100, David Skalka wrote: > > > > > > > > > > it is simple test application with one while. here is > whole > > > > > source > > > > > > > code: > > > > > > > > > > > > > > > > > > > > > > > > > > > > Have you looked at your own data? > > > > > > > > > > > > > > > > > > Oleg > > > > > > > > > > > > > > > > > > > > > > > > > > > > > import java.io.IOException; > > > > > > > > > > > > > > > > > > > > import org.apache.http.impl.client.CloseableHttpClient; > > > > > > > > > > import org.apache.http.impl.client.HttpClientBuilder; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > public class Program { > > > > > > > > > > > > > > > > > > > > public static void main(String[] args) throws > > > IOException, > > > > > > > > > > InterruptedException { > > > > > > > > > > > > > > > > > > > > while(true){ > > > > > > > > > > CloseableHttpClient httpclient = > > > > > > > > > > HttpClientBuilder.create().build(); > > > > > > > > > > httpclient.close(); > > > > > > > > > > Thread.sleep(5); > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 2016-02-02 20:51 GMT+01:00 Oleg Kalnichevski < > > > olegk@apache.org > > > > >: > > > > > > > > > > > > > > > > > > > > > On Tue, 2016-02-02 at 20:42 +0100, David Skalka wrote: > > > > > > > > > > > > sorry i dont understand you. What do you mean by > "what > > > does > > > > > this > > > > > > > all > > > > > > > > > tell > > > > > > > > > > > > you" ? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Have you taken even a cursory look at your own data? > > > > > > > > > > > > > > > > > > > > > > What makes you think there is a leak in HttpClient? > > > > > > > > > > > > > > > > > > > > > > Oleg > > > > > > > > > > > > > > > > > > > > > > > 2016-02-02 20:21 GMT+01:00 Oleg Kalnichevski < > > > > > olegk@apache.org>: > > > > > > > > > > > > > > > > > > > > > > > > > On Tue, 2016-02-02 at 19:30 +0100, David Skalka > > wrote: > > > > > > > > > > > > > > Here is long running snapshot with types > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > https://drive.google.com/open?id=0B8cERbS5JTTtZkVpWmhVWS11UkU > > > > > > > > > > > > > > > > > > > > > > > > > > And what does this all tell you? > > > > > > > > > > > > > > > > > > > > > > > > > > Oleg > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 2016-02-02 17:22 GMT+01:00 Gary Gregory < > > > > > > > garydgregory@gmail.com > > > > > > > > > >: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Can you look and see what kind of objects are > > > > retained? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Gary > > > > > > > > > > > > > > > On Feb 2, 2016 2:33 AM, "David Skalka" < > > > > > > > david.skalka@gmail.com > > > > > > > > > > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Why this code causes a memory leak? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > code: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *while(true){* > > > > > > > > > > > > > > > > * CloseableHttpClient httpclient = > > > > > > > > > > > > > HttpClientBuilder.create().build();* > > > > > > > > > > > > > > > > * httpclient.close();* > > > > > > > > > > > > > > > > * Thread.sleep(5);* > > > > > > > > > > > > > > > > * }* > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Here is a graph of memory allocation: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > https://drive.google.com/file/d/0B8cERbS5JTTtMnUyVXJNZDRFbHM/view > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > > > > > > To unsubscribe, e-mail: > > > > > > > httpclient-users-unsubscribe@hc.apache.org > > > > > > > > > > > > > For additional commands, e-mail: > > > > > > > > > httpclient-users-help@hc.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > > > > To unsubscribe, e-mail: > > > > > httpclient-users-unsubscribe@hc.apache.org > > > > > > > > > > > For additional commands, e-mail: > > > > > > > httpclient-users-help@hc.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > > > To unsubscribe, e-mail: > > > > httpclient-users-unsubscribe@hc.apache.org > > > > > > > > > For additional commands, e-mail: > > > > > httpclient-users-help@hc.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > To unsubscribe, e-mail: > > httpclient-users-unsubscribe@hc.apache.org > > > > > > > For additional commands, e-mail: > > > httpclient-users-help@hc.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > > > > > For additional commands, e-mail: > httpclient-users-help@hc.apache.org > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > *Daniel Quaroni* > > > > Principal Software Architect > > > > P: 781.810.2743 > > > > q@invoke.com > > > > www.invoke.com > > > > See a Demo here > > > > > > > > > > > > > > > -- > > E-Mail: garydgregory@gmail.com | ggregory@apache.org > > Java Persistence with Hibernate, Second Edition > > > > JUnit in Action, Second Edition > > Spring Batch in Action > > Blog: http://garygregory.wordpress.com > > Home: http://garygregory.com/ > > Tweet! http://twitter.com/GaryGregory > > > -- *Daniel Quaroni* Principal Software Architect P: 781.810.2743 q@invoke.com www.invoke.com See a Demo here --001a113f5facaa28ec052ae3607d--