bitpay / insight

A bitcoin blockchain explorer and API
https://insight.bitpay.com/
MIT License
1.19k stars 1.11k forks source link

Out of memory #987

Open silentalk opened 5 years ago

silentalk commented 5 years ago

Insight crashes with the following message:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

had a 3.1.3 node running:

"dependencies": {
    "bitcore-lib": "^v0.13.19",
    "bitcore-node": "^3.1.3",
    "insight-api": "^0.4.3",
    "insight-ui": "^0.4.0"
}

some logs from the crash:

<--- Last few GCs --->

245057237 ms: Mark-sweep 1392.6 (1457.0) -> 1394.9 (1457.0) MB, 2883.1 / 0 ms [allocation failure] [GC in old space requested].
245059886 ms: Mark-sweep 1394.9 (1457.0) -> 1394.7 (1457.0) MB, 2649.4 / 0 ms [allocation failure] [GC in old space requested].
245062520 ms: Mark-sweep 1394.7 (1457.0) -> 1390.3 (1457.0) MB, 2634.0 / 0 ms [last resort gc].
245065159 ms: Mark-sweep 1390.3 (1457.0) -> 1390.7 (1457.0) MB, 2638.5 / 0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x325185837399 <JS Object>
    1: parse [native json.js:~40] [pc=0xa0bc8e77fc0] (this=0x3251858381b1 <a JSON with map 0xf4ced710969>,r=0x20f3e0009be1 <Very long string[346130]>,l=0x325185804131 <undefined>)
    2: arguments adaptor frame: 1->2
    3: /* anonymous */ [/data/btcnode/node_modules/bitcore-node/node_modules/bitcoind-rpc/lib/index.js:97] [pc=0xa0bcf36f3d8] (this=0x335170fc0041 <an IncomingMessage with map 0x2c...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

************************
EXCEPTION: St12out_of_range       
CInv::GetCommand(): type=1073741825 unknown type       
bitcoin in ProcessMessages()       

************************
EXCEPTION: St12out_of_range       
CInv::GetCommand(): type=1073741825 unknown type       
bitcoin in ProcessMessages()       

************************
EXCEPTION: NSt8ios_base7failureE       
non-canonical ReadCompactSize()       
bitcoin in ProcessMessages()       

************************
EXCEPTION: St12out_of_range       
CInv::GetCommand(): type=1073741825 unknown type       
bitcoin in ProcessMessages()       

************************
EXCEPTION: St12out_of_range       
CInv::GetCommand(): type=1073741825 unknown type       
bitcoin in ProcessMessages()

and the index.js around line 97:

      var parsedBuf;
      try {
        parsedBuf = JSON.parse(buf); // line 97
      } catch(e) {
        self.log.err(e.stack);
        self.log.err(buf);
        self.log.err('HTTP Status code:' + res.statusCode);
        var err = new Error(errorMessage + 'Error Parsing JSON: ' + e.message);
        callback(err);
        return;
      }