Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 3C0378D8 for ; Tue, 13 Oct 2015 21:56:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B527C112 for ; Tue, 13 Oct 2015 21:56:15 +0000 (UTC) Received: from [192.168.1.190] (63.135.62.197.nwinternet.com [63.135.62.197] (may be forged)) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id t9DLuAjt027827 (version=TLSv1 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 13 Oct 2015 14:56:11 -0700 From: "Jonathan Toomim (Toomim Bros)" X-Pgp-Agent: GPGMail 2.5.2 Content-Type: multipart/signed; boundary="Apple-Mail=_18C4CD46-E054-4928-A12C-43A49C07A718"; protocol="application/pgp-signature"; micalg=pgp-sha512 Date: Tue, 13 Oct 2015 14:56:08 -0700 Message-Id: <99C42DE7-814A-48F8-AB28-A5ADD77A9FD9@toom.im> To: bitcoin-xt@googlegroups.com, bitcoin-dev@lists.linuxfoundation.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) X-Sonic-CAuth: UmFuZG9tSVaFKQzEFiEYfB6WWfMMhpgXTbCOPmSxNbWXm9kkz+RdLgKrdhn9LUg3lOZclWlD5Ar+tqC/FuUhFvRuoUgV72em X-Sonic-ID: C;+onONvVx5RGKZb0U9jFv0A== M;VPeIN/Vx5RGKZb0U9jFv0A== X-Sonic-Spam-Details: 0.0/5.0 by cerberusd X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [bitcoin-dev] Memory leaks? X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Development Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2015 21:56:16 -0000 --Apple-Mail=_18C4CD46-E054-4928-A12C-43A49C07A718 Content-Type: multipart/alternative; boundary="Apple-Mail=_70B0E8D9-EB1D-4677-B01F-05F2EBBB9C6A" --Apple-Mail=_70B0E8D9-EB1D-4677-B01F-05F2EBBB9C6A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii I just noticed that several of my running bitcoind processes were using = around 3+ GB of RAM, even though the mempool itself seemed to be under = control. XXXX@prime:~/bin$ ./bitcoin-cli getmempoolinfo { "size" : 1896, "bytes" : 37341328 } [total memory usage not shown -- I restarted bitcoind as soon as I = noticed, and didn't copy it down from top] 37 MB mempool, >3 GB RAM usage. Normally, when there aren't a lot of = unconfirmed txns floating around the network, memory usage is around 600 = MB, so this is quite unusual. After restarting the process and letting it run for a few minutes, I = get: PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command [###] [XXXX] 20 0 1402M 317M 49836 S 1.0 8.2 0:41.71 = ./bitcoind -daemon XXXX@prime:~/bin$ ./bitcoin-cli getmempoolinfo { "size" : 1072, "bytes" : 670000 } 0.67 MB mempool, 317 MB RAM usage. Much more reasonable. Here's another node I'm running that has been online longer, before = restarting: PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command [###] [XXXX] 20 0 4961M 3540M 11080 S 2.8 45.3 8h20:11 = bin/bitcoind -daemon XXXX@feather:~$ bin/bitcoin-cli getmempoolinfo { "size" : 3045, "bytes" : 39656126 } 39 MB mempool, 3540 MB total memory usage. After restarting bitcoind, I = see: [XXXX]@feather:~$ bin/bitcoin-cli stop Bitcoin server stopping [XXXX]@feather:~$ bin/bitcoind -daemon Bitcoin server starting [XXXX]@feather:~$ sleep 10; bin/bitcoin-cli getmempoolinfo { "size" : 39, "bytes" : 47037 } PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command [###] [XXXX] 20 0 1640M 247M 67960 S 0.0 3.2 0:05.17 = bin/bitcoind -daemon Does anybody have any guesses where we might be leaking memory, or what = is using the additional 2.4 GB? I've been using minrelaytxfee=3D0.00003 = or similar on my nodes. Maybe there's a leak in the minrelaytxfee code = path? Has anyone else seen something similar? This issue appears to happen both with Bitcoin Core 0.10.1 and with = Bitcoin XT 0.11B. --Apple-Mail=_70B0E8D9-EB1D-4677-B01F-05F2EBBB9C6A Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii I just = noticed that several of my running bitcoind processes were using around = 3+ GB of RAM, even though the mempool itself seemed to be under = control.

XXXX@prime:~/bin$ ./bitcoin-cli getmempoolinfo
{
    "size" : 1896,
    "bytes" : = 37341328
}

[total memory usage not shown -- I = restarted bitcoind as soon as I noticed, and didn't copy it down from = top]

37 MB mempool, >3 GB RAM usage. = Normally, when there aren't a lot of unconfirmed txns floating around = the network, memory usage is around 600 MB, so this is quite = unusual.

After restarting the process and = letting it run for a few minutes, I get:

  PID USER      PRI  = NI  VIRT   RES   SHR S CPU% MEM%   TIME+  = Command
[###] = [XXXX]     20   0 1402M  317M 49836 S  1.0  8.2  = 0:41.71 ./bitcoind -daemon

XXXX@prime:~/bin$ ./bitcoin-cli = getmempoolinfo
{
    = "size" : 1072,
  =   "bytes" : 670000
}

0.67 MB mempool, 317 MB RAM usage. = Much more reasonable.


Here's = another node I'm running that has been online longer, before = restarting:

  PID USER      PRI  NI  VIRT =   RES   SHR S CPU% MEM%   TIME+  Command
[###] [XXXX]     20   0 4961M 3540M 11080 S  2.8 = 45.3  8h20:11 bin/bitcoind = -daemon

XXXX@feather:~$ bin/bitcoin-cli getmempoolinfo
{
    "size" : 3045,
    "bytes" : = 39656126
}

39 MB mempool, 3540 MB total = memory usage. After restarting bitcoind, I = see:

[XXXX]@feather:~$ bin/bitcoin-cli stop
Bitcoin server stopping
[XXXX]@feather:~$ bin/bitcoind = -daemon
Bitcoin server = starting
[XXXX]@feather:~$ sleep 10; bin/bitcoin-cli = getmempoolinfo
{
    = "size" : 39,
    = "bytes" : 47037
}


  PID USER      PRI  NI  VIRT =   RES   SHR S CPU% MEM%   TIME+  Command
[###] [XXXX]     20 =   0 1640M  247M = 67960 S  0.0  3.2  0:05.17 bin/bitcoind = -daemon




<= /div>
Does anybody have any guesses where we might be leaking = memory, or what is using the additional 2.4 GB? I've been = using minrelaytxfee=3D0.00003 or similar on my nodes. = Maybe there's a leak in the minrelaytxfee code path? Has anyone else = seen something similar?

This issue appears to = happen both with Bitcoin Core 0.10.1 and with Bitcoin XT = 0.11B.
= --Apple-Mail=_70B0E8D9-EB1D-4677-B01F-05F2EBBB9C6A-- --Apple-Mail=_18C4CD46-E054-4928-A12C-43A49C07A718 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJWHX36AAoJEIEuMk4MG0P1058IAKdGQtC5prZUSlTsaWBPBYVu +F1Hu5K9Mf09SOgvsphUnviW6n1yxdA9RZIeaiEHCIbTCvaVZ/RaVY1LxRbSXYHI LcK32+Px0x8tVacRpzCzRlWMRb8MjhLjrqbV4JZiHXN+jsoUen/flsrXXlEq6CKw tqSt3MtctzQbm8rNsEGcnYFApCTJNSsEhD1la8mDRQEgo5FfqeM1RAoCmt0i1Wk/ XmOSbFqKqfOXXHn5oLk4baOQXprG5fErEWrNplswcoeoIQCDfGKWOP+WUfhPfRUf pTiQdkuhMZQgEnffQwfJEZGghlA9Xr9Vy5G3Di/J6GOzjzrxZFhJBX91iRJvXW8= =jD7S -----END PGP SIGNATURE----- --Apple-Mail=_18C4CD46-E054-4928-A12C-43A49C07A718--