clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.68k stars 125 forks source link

Clinic Flare exits silently on Apple Silicon and node < 16 #321

Closed giovanni-bertoncelli closed 2 years ago

giovanni-bertoncelli commented 2 years ago

Expected Behavior

When I run the clinic flare inspector I expect that the node script executes completely before exiting and gathering statistics.

Current Behavior

It seems that in my environment even with a super-simple script with a single console.log the flare inspector considers the node script exiting immediately and does not run the script at all, gathering at the end empty statistics. No errors are thrown.

Steps to Reproduce (for bugs)

  1. Get a MacBook with Apple Silicon/M1
  2. Install with nvm node version 12 or less than 16
  3. Create a simple script
  4. Run clinic flare with the script
  5. The script is not executed and flare exits

Sample upload

// test.js
console.log("you'll never see this log!")
clinic flare -- node test.js

Environment

mcollina commented 2 years ago

I think Node.js started supporting M1 Macs officially from Node v16. There might be plenty of things going wrong.

giovanni-bertoncelli commented 2 years ago

Yes, natively it works only with Node v16 and above. But by emulating with Rosetta I think every nodejs version should be compatible: https://doesitarm.com/app/nodejs/, https://github.com/ThatGuySam/doesitarm/issues/299#issuecomment-733210648

mcollina commented 2 years ago

The command is:

clinic flame -- node test.js

Generating flamegraphs is quite a low level task. I would be very surprised if it worked over Rosetta.

I would be happy to receive a PR to make this happen, however I don't think it's something we have the bandwidth to support given that Node v16 is now LTS.

If you have a commercial need for this we (NearForm) are happy to provide long-term support.