davidmarkclements / 0x

🔥 single-command flamegraph profiling 🔥
MIT License
3.23k stars 106 forks source link

No `flamegraph.html` generated in the `<pid>.0x` folder #233

Closed sihunqu123 closed 4 years ago

sihunqu123 commented 4 years ago

use 0x to start my nodejs server

0x src/index

send sig-int

press Ctrl + C to generating flamegraph.

list files generated after a while

ls -A <pid>.0x/ results:

isolate-0x35d5720-4537-v8.log  isolate-0x35d5720-4537-v8.log.json  isolate-0x35d5720-4537-v8.log.preprocess-ready

And there is no flamegraph.html generated.

OS:

[ATLAS][root@atlas-worker-0 worker-microservice]# uname -a                                                                                                                                                                                                                            
Linux atlas-worker-0 5.3.0-1035-aws #37-Ubuntu SMP Sun Sep 6 01:17:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

nodejs: v10.19.0

mcollina commented 4 years ago

can you include a server to reproduce?

sihunqu123 commented 4 years ago

@mcollina sorry, what do u mean by include a server?

sihunqu123 commented 4 years ago

tried the production-server.md

0x --collect-only my-app.js
0x --visualize-only 7777.0x

still no flamegraph.html generated after 0x --visualize-only 7777.0x in the <pid>.0x directory.

sihunqu123 commented 4 years ago

BTW, I noticed that this is a Killed at the end of the terminal:

bb/bbb.yml"],"newPosition":"/bbb/abc/"}}}}}]
🔥  Process exited, generating flamegraphKilled
[ATLAS][root@atlas-worker-0 worker-microservice]#

PS: I have only press the Ctrl+C one time.

mcollina commented 4 years ago

It's impossible to fix this if you do not provide a way to reproduce the problem.

sihunqu123 commented 4 years ago

Yes, we are trying to upload the server code. BTW, the deubg info:

🔥  Process exited, generating flamegraph  0x moving isolate file into folder +0ms
TypeError [ERR_INVALID_ARG_TYPE]: 
🚫  The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at join (path.js:1147:7)
    at v8.catch (/usr/local/site/nodejs/lib/node_modules/0x/index.js:83:27)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  0x TypeError [ERR_INVALID_ARG_TYPE]: 
  0x 🚫  The "path" argument must be of type string. Received type undefined
  0x     at validateString (internal/validators.js:125:11)
  0x     at join (path.js:1147:7)
  0x     at v8.catch (/usr/local/site/nodejs/lib/node_modules/0x/index.js:83:27)
  0x     at process._tickCallback (internal/process/next_tick.js:68:7) +0ms
[ATLAS][root@atlas-worker-0 worker-microservice]#
sihunqu123 commented 4 years ago

@mcollina Resolved, thanks.

The reason the nodejs(the 0x is also a nodejs process) process got killed is

OOMKilled. When there is no enough memory, while 0x requires a large amount of memory, the process will be killed. As a result, not only the html file is not generated, the generated json file is also not valid(the bracket doesn't match).

In addition, as mentioned there Memory Issues / productionServers, we can add --stack-size=8024 to reduce the possibility of OOMKilled. But it still can NOT avoid OOMKilled, especially when the OS RAM is very small. e.g. 500M, which very common in the container env, like docker/k8s.