Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multipleResolves event emitted for Promise.race() #24518

Closed
mcollina opened this issue Nov 20, 2018 · 3 comments
Closed

multipleResolves event emitted for Promise.race() #24518

mcollina opened this issue Nov 20, 2018 · 3 comments

Comments

@mcollina
Copy link
Member

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
@bmeurer
Copy link
Member

bmeurer commented Nov 20, 2018

This seems like a duplicate of #24321

@devsnek
Copy link
Member

devsnek commented Nov 20, 2018

race/all only calling resolve/reject once would be visible to someone doing Promise.race.call(notPromise) (and break the spec)

@devsnek
Copy link
Member

devsnek commented Nov 20, 2018

Duplicate of #24321

@devsnek devsnek marked this as a duplicate of #24321 Nov 20, 2018
@devsnek devsnek closed this as completed Nov 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants