Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ void Environment::InitializeLibuv() {
uv_prepare_init(event_loop(), &idle_prepare_handle_);
uv_check_init(event_loop(), &idle_check_handle_);

uv_async_init(
CHECK_EQ(0, uv_async_init(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a large number of _init calls in this function, isn’t it odd to single some out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@addaleax it's the only one that coverity reported as a problem. Are you suggesting I should add them to the others as as well or not add at all?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference might be that we check the return from uv_check_init everywhere else. This is the actual report:

CID 239987 (#1 of 1): Unchecked return value (CHECKED_RETURN)
3. check_return: Calling uv_async_init without checking return value (as is done elsewhere 15 out of 16 times).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that makes sense – Ideally, we’d check them everywhere, yes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _init methods don't seem to use in other places. I'll add to the other _init methods as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@addaleax added to the other methods in this function.

event_loop(),
&task_queues_async_,
[](uv_async_t* async) {
Expand All @@ -568,7 +568,7 @@ void Environment::InitializeLibuv() {
HandleScope handle_scope(env->isolate());
Context::Scope context_scope(env->context());
env->RunAndClearNativeImmediates();
});
}));
uv_unref(reinterpret_cast<uv_handle_t*>(&idle_prepare_handle_));
uv_unref(reinterpret_cast<uv_handle_t*>(&idle_check_handle_));
uv_unref(reinterpret_cast<uv_handle_t*>(&task_queues_async_));
Expand Down