Skip to content

segfault if clearTimeout(interval) #9561

Description

@watson
  • Version: v6.9.1
  • Platform: Darwin watson-3.local 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64
  • Subsystem:

If using clearTimeout to clear an unreffed Timeout object returned by setInterval(...).unref() you'll get a segfault the next time the interval would normally have fired.

The following example program will segfault after 4 seconds:

// keep the event loop busy while we wait for segfaultsetTimeout(function(){},100000)console.log('setInterval')vartimer=setInterval(clear,2000).unref()functionclear(){console.log('clear - start')// Use clearTimeout instead of clearIntervalclearTimeout(timer)console.log('clear - end')}

The segfault doesn't happen if the Timeout object isn't unreffed.

Even though the user should just use clearInterval instead, this at least shouldn't segfault.

Metadata

Metadata

Assignees

Labels

confirmed-bugIssues with confirmed bugs.timersIssues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions