Skip to content

Commit 6804c0b

Browse files
committed
process: check no handle or request is active after bootstrap
1 parent 470856f commit 6804c0b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/node.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,17 @@ MaybeLocal<Value> RunBootstrapping(Environment* env) {
358358
.IsNothing())
359359
return MaybeLocal<Value>();
360360

361+
// Make sure that no request or handle is created during bootstrap -
362+
// if necessary those should be done in pre-exeuction.
363+
// TODO(joyeecheung): print requests before aborting
364+
if (env->event_loop()->active_handles > 0) {
365+
PrintLibuvHandleInformation(env->event_loop(), stderr);
366+
CHECK_EQ(env->event_loop()->active_handles, 0);
367+
}
368+
CHECK(env->req_wrap_queue()->IsEmpty());
369+
CHECK(env->handle_wrap_queue()->IsEmpty());
370+
CHECK_EQ(env->event_loop()->active_reqs.count, 0);
371+
361372
env->set_has_run_bootstrapping_code(true);
362373

363374
return scope.EscapeMaybe(result);

0 commit comments

Comments
 (0)