Skip to content

Non deterministic order of promise resolution #110

@dlespiau

Description

@dlespiau

If we fire two std.read, jk will currently start two goroutines and the first goroutine to finish will signal the promise as resolved. It means promise resolve functions can be called in any order.

In turns, it opens many non-deterministic behaviour if the promise resolve functions act on a global state: mutate global or captured variables, call the random generator, ...

One possible way to make this a lot better is to resolve the promise in the order they came in. Ensuring the resolve functions are always called in the same order. This depends a bit on the v8 internals and on what happens when a promise is resolved. Need a bit more digging (and a test!)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions