node-http2 icon indicating copy to clipboard operation
node-http2 copied to clipboard

JS Allocation failed - process out of memory

Open pyryjook opened this issue 9 years ago • 2 comments

I cloned this repo to my computer. When I ran the example codes, the client and the server, everything works as expected. But when I copy the exact same codes to my own folder I get the error described in the title.

The only difference is this line:

var http2 = require('..');

... line looks like this in my code, since I'm having a different folder structure than this repo:

var http2 = require('http2');

Before that error is thrown, client.js stdout looks like this (sorry for the ascii color codes):

[90m[2015-04-20T21:28:09.936Z][39m [32m INFO[39m: http2-server/http/13695 on Pyrys-MBP: [36mNew outgoing HTTP/2 connection[39m[90m (server=localhost:8080)[39m
[90m  e: {
    "_readableState": {
      "highWaterMark": 16384,
      "buffer": [
        [
          80,
          82,
          73,
          32,
          42,
          32,
          72,
          84,
          84,
          80,
          47,
          50,
          46,
          48,
          13,
          10,
          13,
          10,
          83,
          77,
          13,
          10,
          13,
          10
        ]
      ],
      "length": 24,
      "pipes": {
        "_readableState": {
          "highWaterMark": 16384,
          "buffer": [],
          "length": 0,
          "pipes": "[Circular]",
          "pipesCount": 1,
          "flowing": true,
          "ended": false,
          "endEmitted": false,
          "reading": true,
          "calledRead": true,
          "sync": true,
          "needReadable": true,
          "emittedReadable": false,
          "readableListening": true,
          "objectMode": false,
          "defaultEncoding": "utf8",
          "ranOut": false,
          "awaitDrain": 0,
          "readingMore": false,
          "decoder": null,
          "encoding": null
        },
        "readable": true,
        "domain": null,
        "_events": {
          "finish": [
            null,
            null
          ],
          "drain": [
            null,
            null
          ]
        },
        "_maxListeners": 10,
        "_writableState": {
          "highWaterMark": 16384,
          "objectMode": false,
          "needDrain": false,
          "ending": false,
          "ended": false,
          "finished": false,
          "decodeStrings": true,
          "defaultEncoding": "utf8",
          "length": 0,
          "writing": false,
          "sync": true,
          "bufferProcessing": false,
          "writecb": null,
          "writelen": 0,
          "buffer": [],
          "errorEmitted": false
        },
        "writable": true,
        "allowHalfOpen": true,
        "pair": {
          "domain": null,
          "_events": {},
          "_maxListeners": 10,
          "_secureEstablished": true,
          "_isServer": false,
          "_encWriteState": true,
          "_clearWriteState": true,
          "_doneFlag": false,
          "_destroying": false,
          "credentials": {
            "context": {}
          },
          "_rejectUnauthorized": false,
          "_requestCert": true,
          "ssl": {},
          "servername": false,
          "npnProtocol": "h2",
          "cleartext": "[Circular]",
          "encrypted": {
            "_readableState": {
              "highWaterMark": 16384,
              "buffer": [],
              "length": 0,
              "pipes": {
                "_connecting": false,
                "_handle": {
                  "fd": 14,
                  "writeQueueSize": 0,
                  "owner": "[Circular]",
                  "reading": true
                },
                "_readableState": {
                  "highWaterMark": 16384,
                  "buffer": [],
                  "length": 0,
                  "pipes": "[Circular]",
                  "pipesCount": 1,
                  "flowing": true,
                  "ended": false,
                  "endEmitted": false,
                  "reading": true,
                  "calledRead": true,
                  "sync": false,
                  "needReadable": true,
                  "emittedReadable": false,
                  "readableListening": false,
                  "objectMode": false,
                  "defaultEncoding": "utf8",
                  "ranOut": false,
                  "awaitDrain": 0,
                  "readingMore": false,
                  "decoder": null,
                  "encoding": null
                },
                "readable": true,
                "domain": null,
                "_events": {
                  "end": [
                    null,
                    null
                  ],
                  "finish": [
                    null,
                    null
                  ],
                  "drain": [
                    null,
                    null
                  ],
                  "error": [
                    null,
                    null
                  ],
                  "close": [
                    null,
                    null
                  ]
                },
                "_maxListeners": 10,
                "_writableState": {
                  "highWaterMark": 16384,
                  "objectMode": false,
                  "needDrain": false,
                  "ending": false,
                  "ended": false,
                  "finished": false,
                  "decodeStrings": false,
                  "defaultEncoding": "utf8",
                  "length": 0,
                  "writing": false,
                  "sync": false,
                  "bufferProcessing": false,
                  "writecb": null,
                  "writelen": 0,
                  "buffer": [],
                  "errorEmitted": false
                },
                "writable": true,
                "allowHalfOpen": false,
                "onend": null,
                "destroyed": false,
                "bytesRead": 1127,
                "_bytesDispatched": 707,
                "_pendingData": null,
                "_pendingEncoding": "",
                "_consuming": true
              },
              "pipesCount": 1,
              "flowing": true,
              "ended": false,
              "endEmitted": false,
              "reading": false,
              "calledRead": true,
              "sync": false,
              "needReadable": true,
              "emittedReadable": false,
              "readableListening": true,
              "objectMode": false,
              "defaultEncoding": "utf8",
              "ranOut": true,
              "awaitDrain": 0,
              "readingMore": false,
              "decoder": null,
              "encoding": null
            },
            "readable": true,
            "domain": null,
            "_events": {
              "end": [
                null,
                null,
                null
              ],
              "finish": [
                null,
                null
              ],
              "close": [
                null,
                null
              ]
            },
            "_maxListeners": 10,
            "_writableState": {
              "highWaterMark": 16384,
              "objectMode": false,
              "needDrain": false,
              "ending": false,
              "ended": false,
              "finished": false,
              "decodeStrings": true,
              "defaultEncoding": "utf8",
              "length": 242,
              "writing": true,
              "sync": true,
              "bufferProcessing": false,
              "writelen": 242,
              "buffer": [],
              "errorEmitted": false
            },
            "writable": true,
            "allowHalfOpen": true,
            "pair": "[Circular]",
            "_pending": null,
            "_pendingEncoding": "",
            "_pendingCallback": null,
            "_doneFlag": false,
            "_retryAfterPartial": false,
            "_halfRead": false,
            "_sslOutCb": null,
            "_resumingSession": false,
            "_reading": true,
            "_destroyed": false,
            "_ended": false,
            "_finished": false,
            "_opposite": "[Circular]",
            "_buffer": {
              "isFull": false,
              "pool": [
                22,
                3,
                1,
                1,
                63,
                1,
                0,
                1,
                59,
                3,
                3,
                170,
                219,
                81,
                166,
                176,
                52,
                5,
                150,
                70,
                178,
                80,
                23,
                133,
                90,
                8,
                15,
                73,
                6,
                197,
                50,
                60,
                179,
                104,
                19,
                196,
                250,
                126,
                104,
                13,
                250,
                208,
                22,
                0,
                0,
                148,
                192,
                48,
                192,
                44,
                192,
                40,
                192,
                36,
                192,
                20,
                192,
                10,
                0,
                163,
                0,
                159,
                0,
                107,
                0,
                106,
                0,
                57,
                0,
                56,
                0,
                136,
                0,
                135,
                192,
                50,
                192,
                46,
                192,
                42,
                192,
                38,
                192,
                15,
                192,
                5,
                0,
                157,
                0,
                61,
                0,
                53,
                0,
                132,
                192,
                47,
                192,
                43,
                192,
                39,
                192,
                35,
....

That goes on and on, containing only zeros after certain point, until the process is out of memory.

Any ideas what is going on?

pyryjook avatar Apr 20 '15 21:04 pyryjook

I was digging further, the problem was apparently caused by bunyan-logger -module. I used it like this:

var log = bunyan.createLogger({name: 'http2-server't});

instead of line:

var log = require('../test/util').createLogger('server');

Seems to have something to do with bunyan's options? I'll dig this further when I have the time.

pyryjook avatar Apr 21 '15 06:04 pyryjook

I'm not sure this is the full root of the problem, but to make a bunyan logger that fully works with node-http2, you definitely need to use test/util.createLogger. Given that, it should probably be refactored out of test and put somewhere more globally available. I'll open a new issue for that work.

nwgh avatar Jan 08 '16 21:01 nwgh