Skip to content

Revise Promise/Resolver Design: Ensure promises can only be resolved once, and ensure that state change is not observable #95

Open
@smarr

Description

@smarr

Currently, promise resolution more than once triggers and assertion, that should be changed and trigger a proper SOMns exception.
Promise cannot be resolved multiple times, and we should not allow silent erroneous resolution and potential unmitigated race conditions.

Doing this with the current promise and resolver design might be broken.

We need to make sure that a loop inside an actor cannot observe the promise being resolved by another actor in a racy manner.

In vats, it is possible that a resolution is triggered in the same actor multiple times, so, it is natural to have the desire to check whether a promise has been resolved. However, this might be racy.
I think, I don't remember exactly, that resolvers a shared as values between actors, so multiple actors might be able to resolve the same promise.

This means, we might need to make promise resolution asynchronous. So, we might need to have something like resolver resolve: [:alreadyResolved | #valueToBeUsedIfNotAlreadyResolved ].
This smells like headache...

Needs further thought and perhaps a different design. Perhaps resolvers should always be far references. And it should be (resolver <-: resolve: value) whenResolved: [:resolutionSuccessful | ... ]. Still not very convincing. In AT, everything was done via messages and futures are a library anyway. Hm...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugFixes an issue, incorrect implementationenhancementImproves the implementation with something noteworthylanguage-designNot everything is in the spec, sometimes, we need to decide what's best.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions