clinicjs / node-clinic

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

Clinic doesn't start load testing ghz process with "--on-port" option #371

Open peter-sereda opened 2 years ago

peter-sereda commented 2 years ago

Hello Guys, maybe someone able to give me an advice with the issue.

I try some experiments with using of Clinic.js Flame tool for performance optimization of our gRPC server. I try to follow the official tutorial but change autocanon with ghz. It works as expected when I run ghz and Clinic as independent processes in different terminal sessions, however hangs indefinitely when I try to combine them both in one command with '--on-port' option.

Expected Behavior

Execution of the command (Windows terminal)

clinic flame --on-port^
 'ghz --insecure -n 1000 --proto ./proto/notes.proto --call myTestService.TestService.List 0.0.0.0:50051 '^
 -- node runTestServer.js

should automatically start ghz, wait for its finish and then open a new flamegraph in browser. Please note that both server and ghz command are correct as if I run them manually in separate terminal processes they work as expected and generate a new flamegraph.

Current Behavior

It starts the test gRPC server and then stuck forever. It requires multiple Ctrl+C to terminate process, flamegraph isn't generated. Seems that ghz process never starts. My guess is that Clinic flame fails to detect an opened port from the testServer.js and never starts ghz, but I am not sure of how to prove it.

Steps to Reproduce (for bugs)

  1. Grab some Node.js gRPC server app.
  2. Install ghz on your machine.
  3. Run the standard clinic flame command as described above.
  4. The command stuck forever after running the server but before calling the ghz.

Environment

Thanks, Peter

RafaelGSS commented 2 years ago

Hello @peter-sereda

Could you create a reproducible code containing a gRPC server? Reference: https://stackoverflow.com/help/minimal-reproducible-example.

I have tried to reproduce locally, but it's working fine.