Skip to content

multipleResolves event emitted for Promise.race() #24518

@mcollina

Description

@mcollina

For 'multipleResolves' to be useful in debugging scenarios, we should treat it as an error-like condition. However, Promise.race() implementation triggers it:

process.on('multipleResolves', function () {
  console.log('multipleResolves', arguments)
  // currently prints:
  // multipleResolves [Arguments] { '0': 'resolve', '1': Promise { 'a' }, '2': 'b' }
})

Promise.race([Promise.resolve('a'), Promise.resolve('b')])

I would recommend we change Promise.race()  implementation in V8 to only call resolve once. Would it be something that could be landed in V8?

cc @benjamingr @BridgeAR @bmeurer @nodejs/v8 @nodejs/promises-debugging

Originally reported as mcollina/make-promises-safe#12.

  • Version: 10.13.0
  • Platform: all
  • Subsystem: Promise

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions