This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
takeHeapSnapshot in node inspect creates corrupted JSON #56
Comments
Yeah, I think so. The issue is that I think the only way to reliably tell whether the |
I did that and it this is the way file ends:
which makes it invalid JSON for sure :) |
addaleax
added a commit
that referenced
this issue
Jan 18, 2018
Instead of treating the total item count like an expected byte length, wait for the JSON data to end before considering the heap snapshot finished. Fixes: #56
jkrems
pushed a commit
that referenced
this issue
Jan 24, 2018
Fix a logic bug in `takeHeapSnapshot()` where it interpreted the item count as the byte count, resulting in truncated snapshots. This change hinges on the observation that the completion callback always comes after any and all `'addHeapSnapshotChunk'` events. I'm 95% sure after digging into the V8 inspector and its integration with Node.js that the assumption above is correct. If it turns out I'm mistaken, then we will most likely treat that as a bug in Node.js, not node-inspect. Fixes: #56
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am trying to use "node inspect" to attach to the already running node process to collect the heap dump. Using the command:
takeHeapSnapshot(filepath = 'node.heapsnapshot') Take a heap snapshot and save to disk as JSON.
The command seems to be completed successfully.
debug> takeHeapSnapshot(filepath = 'node.heapsnapshot')
Heap snaphost prepared.
Wrote snapshot: /Users/aleksander/node.heapsnapshot
But afterwards I am trying to open it in "Node.js V8 --inspector Manager (NiM) 0.14.5" it throws the following error:
When I open the generated dump it seems to be a corrupted JSON ending prematurely with:
",2,8443,81187,32,1,0
,1,46,81189,32,"
Is this a node inspect bug? I am able to succesfully connect to the same instance of node by the browser and use the "Take heap snapshot" function where the generated dump opens without any problems. Also noticed that the properly generated dump has about 80MB where the corrupted one only 800K.
I thought that maybe I am doing something wrong but since no error is reported and we end up with the corrupted JSON this seems to be an issue...
The text was updated successfully, but these errors were encountered: