Conversation
richardlau
left a comment
There was a problem hiding this comment.
Will try to find time to look at the technical aspects. Left a few comments re. tests.
Also maybe bump the NODE_REPORT_VERSION?
Line 22 in 4187fcb
I'm a bit unsure on the criterea for bumping the version (#28121 (comment)), but this does add a new section and header value.
cc @boneskull as a tool author that consumes the report.
Actually reskimming the PR it looks like the support for workers is to nest reports inside the report so this probably does need a version bump. |
|
@addaleax - this is awesome!
|
|
also, I am finding it difficult to relate the other commits with |
@richardlau Done, although I agree that there should be documentation on the circumstances under which the version is bumped – otherwise it doesn’t seem like a useful value.
@gireeshpunathil Thanks! :)
I think the question should be whether there are any upsides to inhibiting workers from taking reports. I don’t see any, and I’m not a fan of arbitrary restrictions, so I’d go with “no” for now. (I.e. the “obvious” downside is that it makes the report feature less powerful.)
I don’t think so. Workers are sub-objects of their parent threads, and in particular, listing them as siblings would lose the tree structure of Workers, i.e. a Worker started by a Worker would be indistinguishable from a Worker started by the main thread in the case of listing them as siblings (unless information like the parent thread id or similar is added).
I’ve added a section to the report docs, PTAL 👍
Yes, I’ve thought about that too. For now, duplicating the information seemed somewhat reasonable because it means that any Worker’s report itself is a fully valid report that can be looked at independently, but I also see the benefit of excluding per-process information. (And in particular, for the environment variables, it’s not really correct to just use the “global” env vars, imo. But then again, that problem seems independent from this PR – we’re already doing this for reports generated from Workers.)
As the PR description says – it’s work leading up to it and related cleanup. Removing |
|
re: worker taking reports - because of this env->ForEachWorker([&](Worker* w) {will it loose out taking report for the main thread? |
Reports taken from Workers don’t include parent threads, that’s correct. I would also consider this the expected behaviour. |
|
Regarding versioning, we really ought to have used semver for the versioning model on the format. Perhaps it's not too late to switch? |
It was originally going to use semver, but I was asked to change it in #28121 (comment). |
|
Let's move the versioning question to nodejs/diagnostics#349, it's definitely bigger than this PR. |
|
Fwiw, this is weirdly breaking one specific HTTP/2 test on Windows. I'm investigating, but that means that this PR still needs at least a minor fixup. |
|
I've pushed a commit that seems to resolve the Windows issue for me, locally (hopefully CI will confirm that). It restores behaviour that was present before the first commit in this PR, where the native The HTTP/2 implementation seems to rely on that in some way, but honestly, that seems like a bug waiting to happen (and maybe even the reason for all the Windows HTTP/2 flakiness?), so I'd like to investigate more tomorrow. |
Notable changes: * async_hooks: * add executionAsyncResource (Matteo Collina) #30959 * doc: * add ronag to collaborators (Robert Nagy) #31498 * crypto: * add crypto.diffieHellman (Tobias Nießen) #31178 * add DH support to generateKeyPair (Tobias Nießen) #31178 * simplify DH groups (Tobias Nießen) #31178 * add key type 'dh' (Tobias Nießen) #31178 * report: * add support for Workers (Anna Henningsen) #31386 * src: * move MemoryInfo() for worker code to .cc files (Anna Henningsen) #31386 * add interrupts to Environments/Workers (Anna Henningsen) #31386 * remove AsyncRequest (Anna Henningsen) #31386 * add a threadsafe variant of SetImmediate() (Anna Henningsen) #31386 * exclude C++ SetImmediate() from count (Anna Henningsen) #31386 * better encapsulate native immediate list (Anna Henningsen) #31386 * test: * skip keygen tests on arm systems (Tobias Nießen) #31178
Notable changes: * async_hooks: * add executionAsyncResource (Matteo Collina) #30959 * doc: * add ronag to collaborators (Robert Nagy) #31498 * crypto: * add crypto.diffieHellman (Tobias Nießen) #31178 * add DH support to generateKeyPair (Tobias Nießen) #31178 * simplify DH groups (Tobias Nießen) #31178 * add key type 'dh' (Tobias Nießen) #31178 * report: * add support for Workers (Anna Henningsen) #31386 * test: * skip keygen tests on arm systems (Tobias Nießen) #31178
Notable changes: * async_hooks: * add executionAsyncResource (Matteo Collina) #30959 * doc: * add ronag to collaborators (Robert Nagy) #31498 * crypto: * add crypto.diffieHellman (Tobias Nießen) #31178 * add DH support to generateKeyPair (Tobias Nießen) #31178 * simplify DH groups (Tobias Nießen) #31178 * add key type 'dh' (Tobias Nießen) #31178 * report: * add support for Workers (Anna Henningsen) #31386 * test: * skip keygen tests on arm systems (Tobias Nießen) #31178 PR-URL: #31837
Notable changes: * async_hooks: * add executionAsyncResource (Matteo Collina) #30959 * doc: * add ronag to collaborators (Robert Nagy) #31498 * crypto: * add crypto.diffieHellman (Tobias Nießen) #31178 * add DH support to generateKeyPair (Tobias Nießen) #31178 * simplify DH groups (Tobias Nießen) #31178 * add key type 'dh' (Tobias Nießen) #31178 * report: * add support for Workers (Anna Henningsen) #31386 * test: * skip keygen tests on arm systems (Tobias Nießen) #31178 PR-URL: #31837
Notable changes: * async_hooks * add executionAsyncResource (Matteo Collina) #30959 * crypto * add crypto.diffieHellman (Tobias Nießen) #31178 * add DH support to generateKeyPair (Tobias Nießen) #31178 * simplify DH groups (Tobias Nießen) #31178 * add key type 'dh' (Tobias Nießen) #31178 * test * skip keygen tests on arm systems (Tobias Nießen) #31178 * perf_hooks * add property flags to GCPerformanceEntry (Kirill Fomichev) #29547 * process * report ArrayBuffer memory in `memoryUsage()` (Anna Henningsen) #31550 * readline * make tab size configurable (Ruben Bridgewater) #31318 * report * add support for Workers (Anna Henningsen) #31386 * worker * add ability to take heap snapshot from parent thread (Anna Henningsen) #31569 * added new collaborators * add ronag to collaborators (Robert Nagy) #31498 PR-URL: #31837
Notable changes: * async_hooks * add executionAsyncResource (Matteo Collina) #30959 * crypto * add crypto.diffieHellman (Tobias Nießen) #31178 * add DH support to generateKeyPair (Tobias Nießen) #31178 * simplify DH groups (Tobias Nießen) #31178 * add key type 'dh' (Tobias Nießen) #31178 * test * skip keygen tests on arm systems (Tobias Nießen) #31178 * perf_hooks * add property flags to GCPerformanceEntry (Kirill Fomichev) #29547 * process * report ArrayBuffer memory in `memoryUsage()` (Anna Henningsen) #31550 * readline * make tab size configurable (Ruben Bridgewater) #31318 * report * add support for Workers (Anna Henningsen) #31386 * worker * add ability to take heap snapshot from parent thread (Anna Henningsen) #31569 * added new collaborators * add ronag to collaborators (Robert Nagy) #31498 PR-URL: #31837
|
@addaleax should this go to 12? It's not a clean bp - Ill add the label but feel free to swap it. |
Only the last commit is concerned with the report feature itself. The other commits are work leading up to it, making features like this easier to add in general, and related cleanup.
src: better encapsulate native immediate list
Refactor for clarity and reusability. Make it more obvious that the
list is a FIFO queue.
src: exclude C++ SetImmediate() from count
There is no real reason to manage a count manually, given that
checking whether there are C++ callbacks is a single pointer
comparison.
This makes it easier to add other kinds of native C++ callbacks
that are managed in a similar way.
src: add a threadsafe variant of SetImmediate()
Add a variant of
SetImmediate()that can be called from any thread.This allows removing the
AsyncRequestabstraction and replaces itwith a more generic mechanism.
src: remove AsyncRequest
Remove
AsyncRequestfrom the source code, and replace itsusage with threadsafe
SetImmediate()calls. This has theadvantage of being able to pass in any function, rather than
one that is defined when the
AsyncRequestis “installed”.This necessitates two changes:
in the other) is now a direct member of the
Environmentclass.manual management of their libuv ref count.
As a drive-by fix, the
can_call_into_jsvariable was turnedinto an atomic variable. While there have been no bug reports,
the flag is set from
Stop(env)calls, which are supposed tobe possible from any thread.
src: add interrupts to Environments/Workers
Allow doing what V8’s
v8::Isolate::RequestInterrupt()does for V8.This also works when there is no JS code currently executing.
src: move MemoryInfo() for worker code to .cc files
This is a) the right thing to do anyway because these functions
can not be inlined by the compiler and b) avoids compilation warnings
in the following commit.
report: add support for Workers
Include a report for each sub-Worker of the current Node.js instance.
This adds a feature that is necessary for eventually making the report
feature stable, as was discussed during the last collaborator summit.
Refs: openjs-foundation/summit#240
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes