-
-
Notifications
You must be signed in to change notification settings - Fork 45
Additional information for libuv handles #73
Conversation
Node.js 8 nightly CI: https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/127/ |
|
Looking at the libuv api’s uv_process_t could probably display pid and command line options from http://docs.libuv.org/en/v1.x/process.html Could the code for extending buffers in the Adding read/write flags sounds like a better approach but it adds columns that only apply to some types. I’m not sure how best we can make the output a bit easier to read but I think that’s along the right lines. Could we group handles together by type or common fields (e.g. tcp/udp/pipes together) so we can add some extra column headings instead of the “fieldname: value” format? I don’t want to do too much processing in node-report, it’s supposed to be quick but it’s also supposed to be human readable. |
src/node_report.cc
Outdated
free(buffer); \ | ||
} \ | ||
} \ | ||
while (0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to pull out the filename writing code as a function. You can pass the handle with uv_any_handle* handle and check if it's a poll or event where it needs to using handle->handle.type.
src/node_report.cc
Outdated
case UV_TCP: type = "tcp"; break; | ||
case UV_TIMER: type = "timer"; break; | ||
case UV_TTY: type = "tty"; break; | ||
case UV_TCP: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably pull all this out as a function as well and support UDP and PIPE handles with uv_udp_getsockname and uv_pipe_getsockname there too.
out << "\nFlags Type Address\n"; | ||
out << std::left << std::setw(7) << "Flags" << std::setw(10) << "Type" | ||
<< std::setw(4 + 2 * sizeof(void*)) << "Address" << "Details" | ||
<< std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been caught out by setting formatting flags before, they are set on the stream so any other users will be affected by them later on. (It's a problem if we are writing to stdout or stderr!)
Using them is fine but I think we should probably call:
std::ios_base::fmtflags format = out.flags();
to save them at the start of WriteNodeReport and:
out.flags(format);
so we leave the streams as we found them. (I think that will reset things like fill characters but we should probably test it to be sure.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't reset fill, but copyfmt
does so I've used that instead.
Is it not possible to get the timer duration from timers? Also, maybe comma-separate fields in the "Details"? |
Doesn't look like it is: http://docs.libuv.org/en/v1.x/timer.html |
@richardlau can you try just using |
@Fishrock123 - That looks good but might not help for older levels of libuv. Would an alternative be to update the libuv docs to say handle->timeout is a public field that can be read? |
@hhellyer you're right about the older versions thing, would an |
Factored out reporting of paths for fs events/poll and endpoints for tcp and udp. uv_pipe_getsockname/uv_pipe_getpeername take different argument types compared to the tcp/udp equivalents so I'm undecided as to whether to handle pipes in the same function. TODO:
|
Implemented todos in previous comment and rebased onto current master. PTAL. |
Failures on Windows: ..\src\node_report.cc(623): error C2039: 'timeout': is not a member of 'uv_timer_s' [C:\workspace\nodereport-continuous-integration\MACHINE\win2012r2\node-report\build\api.vcxproj]
C:\Users\dev\.node-gyp\8.0.0-nightly201705043f48ab3042\include\node\uv.h(778): note: see declaration of 'uv_timer_s' |
Okay, changed to use v8.0.0-nightly CI: https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/158/ |
TODO (probably Monday):
|
Looks good. I think timer values are unsigned so I'm wondering if there's some implementation details in Node.js that causes them to be very large deliberately. (But to be honest I'm not really sure!) |
src/node_report.cc
Outdated
|
||
if (h->type == UV_TCP || h->type == UV_NAMED_PIPE || h->type == UV_TTY) { | ||
|
||
data << ", write queue size " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: could you add the usual colon after 'write queue size' to separate the name from the value, for consistency
Added the colon after I'll start some CI runs. Let me know if you want me to squash the fixup commits, or if you'll do that when landing. |
Node.js v4 CI: https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/160/ Seems to be some missing v8.0.0-nightly builds: https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/159/ |
@richardlau we squash commits when landing, so no need for you to do it Agree the v8 CI build failures are just missing Node build .zip files |
@richardlau - I'm fine with leaving repeat in, Node.js could change it's implementation and native npms can access libuv directly and I think could (in theory) put their own timers on the event loop. |
Landing this shortly |
@richardlau sorry, could you rebase this please, there is a clash with #82 that landed recently Also I think there is a test failure in test/test-api-uvhandles.js on one platform: |
@rnchamberlain I've rebased onto the current master, but now I get a compilation failure with Node.js 4.8.3: Node.js 4.8.3 compilation failure
|
Looking into AIX failure,
|
@richardlau - The compilation failure with 4.8.3 is in existing code added for PR #82 so I've raised a separate issue #87. |
The line that fails on AIX is using fs.watch, this has limitations on AIX: (fs.watchFile should still work, fs.watch is just more efficient.) |
Rebased onto current master to pick up the 4.8.3 compilation failure fix and updated testcase to skip the fs_event handle check if fs.watch() failed for any reason. Node.js v4.x CI: https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/168/ |
Great, thanks @richardlau, landing this shortly |
PR-URL: #73 Reviewed-By: Howard Hellyer <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Richard Chamberlain <[email protected]>
Landed as c7056c5, many thanks @richardlau @hhellyer and reviewers |
Forgot the original AIX failure was on Node.js v6 (fs.watch() was reenabled a later libuv included in the Node.js v8.0.0-nightlies). Node.js v6.x CI: https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/180/ And for posterity: https://ci.nodejs.org/view/post-mortem/job/nodereport-continuous-integration/180/MACHINE=aix61-ppc64/console Passing test on AIX (fs.watch() skipped)
|
Co-authored-by: Jeremiah Senkpiel <[email protected]> Refs: nodejs/node-report#73 Refs: #1255 Fixes: #2950 PR-URL: #2951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Co-authored-by: Jeremiah Senkpiel <[email protected]> Refs: nodejs/node-report#73 Refs: #1255 Fixes: #2950 PR-URL: #2951 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Adds details for libuv handle types.
e.g.
Suggestions welcome on formatting. For the moment I've kept the first three columns as they were (originally based on
uv_print_all_handles
but rewritten in #48). Perhaps we can turn readable/writable into flags?cc @hhellyer