Open cxreg opened 7 years ago
+1 same issue
segmentation fault
@ hustxiaoc
@cxreg @linxuanwei try this: https://www.npmjs.com/package/v8-profiler-node8
@hyj1991 can you help me what have you changed there in the cc / h files?
It looks like he simply isn't passing the progress callback when running in Node 8
I can confirm that this is the source of the crash, although I think this will cause tests to fail, and constitutes a reduction in functionality. From what I can tell it looks like Nan::GetCurrentContext()
is returning an empty context in Node 8, where this was not the case in earlier versions. I don't know enough about v8 to understand why, though
@rvagg can you help us here please?
@kkoopa @bnoordhuis might have a clue here
ReportProgressValue() calls into JS land. Don't do that. :-)
It may have worked by accident in the past but I don't think it was ever safe to do so.
Also, why are the adapter classes heap allocated? They never seem to be freed.
The adapter needs to be heap allocated because Serialize
isn't completed synchronously. I think there's a missing delete this;
in OutputStreamAdapter::EndOfStream
Edit: nevermind, it does complete before Serialize returns, it just iterates over WriteAsciiChunk
before doing so. So yeah this probably should be on the stack
@hyj1991
"v8-profiler-node8" ( version: 5.7.6) is OK
Can you merge this to v8-profiler ?
snapshot.delete() segmentation fault core dumped also when using v8-profiler-node8 I'm using node 8.1.4
puzzling
profile1.export(function(error, result) { fs.writeFileSync('profile1.json', result); profile1.delete(); //is ok });
snapshot2.export() .pipe(fs.createWriteStream('snapshot2.json')) .on('finish', snapshot2.delete); //segmentation fault
//and It's ok as follow :
snapshot2.export() .pipe(fs.createWriteStream('snapshot2.json')) .on('finish', function(){ snapshot2.delete(); });
@lmyzzu follow will be ok:
snapshot2.export()
.pipe(fs.createWriteStream('snapshot2.json'))
.on('finish', snapshot2.delete.bind(snapshot2));
The delete method should probably throw instead of segfault when called unbound. But that's a separate issue from this one
Although v8-profiler is great, there doesn't seem to be a lot of activity in the repo. That's why i've created a new module which works from nodejs 6.3+, so nodejs 8 works as well. It can create heapdumps and CPU profiles as well.
Attempting to take a snapshot segfaults
I built a Debug build and got this stacktrace