Skip to content

Instantly share code, notes, and snippets.

@triblondon
Last active November 1, 2015 23:24
Show Gist options
  • Save triblondon/225357def9998c0492f7 to your computer and use it in GitHub Desktop.
Save triblondon/225357def9998c0492f7 to your computer and use it in GitHub Desktop.
Weird Node error when using mismatched setInterval vs clearTimeout
var timer;
function a() {
console.log('foo');
// timer is an interval timer, but clear it as if it's a timeout timer
clearTimeout(timer);
}
timer = setInterval(a, 1000);
timer.unref();
// Keep the loop going for 3 seconds
setTimeout(function() {}, 3000);
foo
Assertion failed: (HandleWrap::IsAlive(wrap)), function Start, file ../src/timer_wrap.cc, line 74.
Abort trap: 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment