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

make .stop() flush #26

Open
eh-am opened this issue Jan 31, 2023 · 0 comments
Open

make .stop() flush #26

eh-am opened this issue Jan 31, 2023 · 0 comments

Comments

@eh-am
Copy link
Collaborator

eh-am commented Jan 31, 2023

This is going to be tricky.

When stopping the profiler, it only sets up a stop flag
https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L284
Which only affects the next profiling round
https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L257-L264

That means that it may take up to 10 seconds (the profiling round) to exit
https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L204

This behaviour is pretty clear when running tests, where the test runner hangs up to 10 seconds, and the last profile captured is full of idle, since the program it's not doing anything.

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