diff --git a/lib/timers.js b/lib/timers.js index a4a2c17c93e..d0a154a08bd 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -59,7 +59,6 @@ function insert(item, msecs) { list = lists[msecs]; } else { list = new Timer(); - list.start(msecs, 0); L.init(list); @@ -67,6 +66,10 @@ function insert(item, msecs) { list.msecs = msecs; list[kOnTimeout] = listOnTimeout; } + // Call start regardless whether list is new + // or not to prevent incorrect active_handles + // count. See issue #25831. + list.start(msecs, 0); L.append(list, item); assert(!L.isEmpty(list)); // list is not empty