thlorenz / flamegraph

Generates flamegraphs with Node.js or in the browser.
http://thlorenz.github.io/flamegraph/web/
MIT License
165 stars 28 forks source link

failure when reading large file #22

Open trevnorris opened 7 years ago

trevnorris commented 7 years ago

Using the latest flamegraph on npm I got the following error:

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: "toString()" failed
    at Buffer.toString (buffer.js:496:11)
    at ondata (/tmp/node_modules/flamegraph/from-stream.js:35:32)
    at ConcatStream.<anonymous> (/tmp/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:91:20)
    at ConcatStream.emit (events.js:185:7)
    at finishMaybe (/tmp/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:460:14)
    at endWritable (/tmp/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:469:3)
    at ConcatStream.Writable.end (/tmp/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:436:5)
    at ReadStream.onend (_stream_readable.js:511:10)
    at ReadStream.g (events.js:291:16)

Using these script and map files. Reason for this issue is because the file is larger than process.binding('buffer').kStringMaxLength (around 255MB on x64). Can see this from this line.

Solution is to allow files larger than 255MB.