-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
src: add error message if we abort #8634
Conversation
@@ -13,6 +13,10 @@ Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate), | |||
loop_ = new uv_loop_t; | |||
CHECK(loop_); | |||
rc = uv_loop_init(loop_); | |||
if (rc != 0) { | |||
FatalError("node::Watchdog::Watchdog()", |
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.
style: I think indentation should be 2 spaces here
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.
Thanks for catching it! I keep forgetting that ESlint doesn't complain about C++ formatting. Does anybody want to share their vimrc with me for correct auto formatting?
@@ -13,6 +13,10 @@ Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate), | |||
loop_ = new uv_loop_t; | |||
CHECK(loop_); | |||
rc = uv_loop_init(loop_); | |||
if (rc != 0) { | |||
FatalError("node::Watchdog::Watchdog()", | |||
"Failed to initialize loop. Maybe the file limit is reached?"); |
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.
style: align with previous argument ?
@@ -13,6 +13,10 @@ Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate), | |||
loop_ = new uv_loop_t; | |||
CHECK(loop_); | |||
rc = uv_loop_init(loop_); | |||
if (rc != 0) { | |||
FatalError("node::Watchdog::Watchdog()", |
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.
The indentation looks off here.
@@ -13,6 +13,10 @@ Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate), | |||
loop_ = new uv_loop_t; | |||
CHECK(loop_); | |||
rc = uv_loop_init(loop_); | |||
if (rc != 0) { | |||
FatalError("node::Watchdog::Watchdog()", | |||
"Failed to initialize loop. Maybe the file limit is reached?"); |
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'm not sure about the second part of this error message. If we can't say with certainty what the problem is, I don't think we should leave questions like this.
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.
Maybe we could then check if the file limit was actually reached?
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 was trying to make the message more helpful than just saying that the call failed. But I'm also OK with deleting the second part.
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 it say "initialize uv loop"? To give more context?
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.
Maybe we could then check if the file limit was actually reached?
That would be pretty nice. I’m not sure whether that’s feasible to do in a cross-platform way, but for POSIXes it probably would work.
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.
Yeah, I think @addaleax is right that it may be difficult to do x-platform reliably. The message could be extended a bit with something like, Failed to initialize loop. This may be caused, for instance, by reaching the file limit.
@@ -13,6 +13,10 @@ Watchdog::Watchdog(v8::Isolate* isolate, uint64_t ms) : isolate_(isolate), | |||
loop_ = new uv_loop_t; | |||
CHECK(loop_); | |||
rc = uv_loop_init(loop_); | |||
if (rc != 0) { | |||
FatalError("node::Watchdog::Watchdog()", |
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.
sorry to bother you, but indentation is still off by 1.
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.
No problem, my fault for being sloppy.
892de33
to
7fe7b13
Compare
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.
LGTM pending CI
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.
LGTM
Oh, @thealphanerd do you feel citgm should be run before landing this? |
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.
LGTM but the commit message should start with vm:
or maybe src:
?
(I don’t think CITGM is really necessary here, but if somebody wants to run it, sure)
if (rc != 0) { | ||
FatalError("node::Watchdog::Watchdog()", | ||
"Failed to initialize uv loop."); | ||
} | ||
CHECK_EQ(0, rc); |
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 think this line can be dropped.
Add an error message in watchdog if we abort because uv_loop_init fails. Fixes nodejs#8555
I fixed the formatting, error message, extra CHECK, and commit message. CI again: https://ci.nodejs.org/view/All/job/node-test-pull-request/4146/ |
I don't believe it needs to be but should this be semver-major? |
I don't think this should be semver major since it's an abort. I'd go with patch. |
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.
LGTM
I'll start landing this:
|
Add an error message in watchdog if we abort because uv_loop_init fails. PR-URL: nodejs#8634 Fixes: nodejs#8555 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@fhinkel do you think this should be backported? |
ping @fhemberger |
I guess you wanted to ping @fhinkel. 😄 |
ping @fhinkel |
If it lands cleanly, yes. |
Checklist
make -j4 test
(UNIX) passesAffected core subsystem(s)
vm, watchdog
Description of change
Add an error message if we abort because uv_init_loop fails.
Fixes #8555