Skip to content

core: handle._handle.close(callback) is not idempotent #1287

Description

@bnoordhuis

handle._handle.close(callback) is not idempotent and that's because node::HandleWrap::Close() overrides the .close method with the callback. This one-liner should print 'Trace' only once:

$ iojs -e 'var t = new (process.binding("timer_wrap").Timer); t.close(console.trace); t.close()'
Trace
    at [eval]:1:78
    at Object.exports.runInThisContext (vm.js:54:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:410:26)
    at evalScript (node.js:475:25)
    at startup (node.js:84:9)
    at node.js:867:3
Trace

Activity

  1. added a commit that references this issue on Feb 22, 2026
    77c2da1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions