-
Notifications
You must be signed in to change notification settings - Fork 320
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
π Bug Report β CPU profiling reports entire execution as (program)
#1754
Comments
harrishancock
added a commit
that referenced
this issue
Jun 6, 2024
V8's profiler does not expect isolates to be locked from different threads. Pull request #710 moved inspector protocol handling to a separate thread, meaning profiling was started and stopped on the inspector thread, not the Worker's request connection thread. If I remember right, the result of this is that the profiler ends up sampling the inspector thread, which doesn't normally run JavaScript, and causes a bunch of "(program)" placeholder spans to show up in the profile. We previously discovered this issue with our internal runtime, which has always been heavily multi-threaded, and patched around the problem. This commit copies the two relevant patches from our internal repo. Fixes #1754.
harrishancock
added a commit
that referenced
this issue
Aug 20, 2024
This commit adds a regression test for the CPU profiling bug reported in #1754 and fixed in #2497. It is based on @mrbbot's original reproduction. I backported the test to the commit just prior to #2497, and confirmed that the test caught the original breakage. I wrote the test in JavaScript, because it seemed to have the richest ecosystem of tools for working with the Chrome Devtool Protocol. I originally intended to use Playwright to initiate a CDP connection to workerd, but it seemed to make too many assumptions that it was connecting to a browser. I tried the [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface) library next, and it seemed to work well. Fixes #1754.
harrishancock
added a commit
that referenced
this issue
Aug 20, 2024
This commit adds a regression test for the CPU profiling bug reported in #1754 and fixed in #2497. It is based on @mrbbot's original reproduction. I backported the test to the commit just prior to #2497, and confirmed that the test caught the original breakage. I wrote the test in JavaScript, because it seemed to have the richest ecosystem of tools for working with the Chrome Devtool Protocol. I originally intended to use Playwright to initiate a CDP connection to workerd, but it seemed to make too many assumptions that it was connecting to a browser. I tried the [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface) library next, and it seemed to work well. Fixes #1754.
harrishancock
added a commit
that referenced
this issue
Aug 20, 2024
This commit adds a regression test for the CPU profiling bug reported in #1754 and fixed in #2497. It is based on @mrbbot's original reproduction. I backported the test to the commit just prior to #2497, and confirmed that the test caught the original breakage. I wrote the test in JavaScript, because it seemed to have the richest ecosystem of tools for working with the Chrome Devtool Protocol. I originally intended to use Playwright to initiate a CDP connection to workerd, but it seemed to make too many assumptions that it was connecting to a browser. I tried the [chrome-remote-interface](https://github.com/cyrus-and/chrome-remote-interface) library next, and it seemed to work well. Fixes #1754.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey! π When investigating cloudflare/workers-sdk#4409, I observed that CPU profiles from
workerd
contain a single(program)
entry for the entire duration of the profile. To reproduce this......then run...
$ npx workerd serve config.capnp --verbose --control-fd=1 --watch --inspector-addr=127.0.0.1:9229 & $ node stress.mjs
...then visit
chrome://inspect
to open DevTools and start a CPU profile for a few seconds. For me, the result looks something like...If I run the following similar code in Node directly with
node --inspect-brk index-node.mjs
, visitchrome://inspect
and start a CPU profile I see something like...I get that Node probably implements more of these APIs in JavaScript, hence the deeper flame graphs, but I'd still expect to see
pbkdf2Dervie()
in theworkerd
profile's flame graph.The text was updated successfully, but these errors were encountered: