Skip to content
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

watchdog: fix timeout not running if polling returned early #622

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
8 changes: 6 additions & 2 deletions src/node_watchdog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ void Watchdog::Destroy() {
void Watchdog::Run(void* arg) {
Watchdog* wd = static_cast<Watchdog*>(arg);

// UV_RUN_ONCE so async_ or timer_ wakeup exits uv_run() call.
uv_run(wd->loop_, UV_RUN_ONCE);
// UV_RUN_DEFAULT the loop will be stopped either by the async or the
// timer handle.
uv_run(wd->loop_, UV_RUN_DEFAULT);

// Loop ref count reaches zero when both handles are closed.
// Close the timer handle on this side and let Destroy() close async_
Expand All @@ -75,11 +76,14 @@ void Watchdog::Run(void* arg) {


void Watchdog::Async(uv_async_t* async) {
Watchdog* w = ContainerOf(&Watchdog::async_, async);
uv_stop(w->loop_);
}


void Watchdog::Timer(uv_timer_t* timer) {
Watchdog* w = ContainerOf(&Watchdog::timer_, timer);
uv_stop(w->loop_);
V8::TerminateExecution(w->env()->isolate());
}

Expand Down