Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flamegraph does not work on Windows #111

Open
abyrd-phx opened this issue Mar 11, 2024 · 0 comments
Open

flamegraph does not work on Windows #111

abyrd-phx opened this issue Mar 11, 2024 · 0 comments

Comments

@abyrd-phx
Copy link

morgue flamegraph myproj --filter "application,equal,FooServer" -o out.svg

C:\Users\abyrd\AppData\Roaming\npm\node_modules\backtrace-morgue\node_modules\backtrace-node\lib\backtraceClient.js:270
            throw e;
            ^

Error: spawn UNKNOWN
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at C:\Users\abyrd\AppData\Roaming\npm\node_modules\backtrace-morgue\bin\morgue.js:5338:17
    at onResponse (C:\Users\abyrd\AppData\Roaming\npm\node_modules\backtrace-morgue\lib\coroner.js:108:5)
    at Request._callback (C:\Users\abyrd\AppData\Roaming\npm\node_modules\backtrace-morgue\lib\coroner.js:391:12)
    at self.callback (C:\Users\abyrd\AppData\Roaming\npm\node_modules\backtrace-morgue\node_modules\request\request.js:185:22) 
    at Request.emit (node:events:519:28)
    at Request.<anonymous> (C:\Users\abyrd\AppData\Roaming\npm\node_modules\backtrace-morgue\node_modules\request\request.js:1154:10)
    at Request.emit (node:events:519:28)
    at IncomingMessage.<anonymous> (C:\Users\abyrd\AppData\Roaming\npm\node_modules\backtrace-morgue\node_modules\request\request.js:1076:12) {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'spawn'
}

Node.js v21.7.1

I believe this comes from assuming the pl file itself is executable, but shebang doesn't work on Windows.

#!/usr/bin/perl -w

spawn can call the appropriate executable with the script as an argument. This appears to work, but I don't know if enough about this ecosystem to know whether it's the right thing to do.
var child = spawn('node', [flamegraph]);

At least, it doesn't crash, but I end up with an empty svg. I can confirm the script is executing, the correct data is being returned, and it's being output to child.stdin. The problem appears to be here. The file is successfully created, but the pipe call doesn't end up outputting anything to it. I imagine this is because the child process is now node running a script, rather than the perl instance itself.

child.stdout.pipe(stream);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant