You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resolving a vow to itself, either directly or through intermediate promises and/or other vows, result in an infinite loop through shortening.
Unlike promise self resolution which at best result in a data lock when awaited, the consequence here is a full livelock (no other work ends up processed while in the infinite loop)
To Reproduce
test.failing('vow self resolution',asynct=>{constzone=makeHeapZone();const{ watch, when, makeVowKit }=prepareVowTools(zone);// A direct self vow resolutionconst{vow: vow1,resolver: resolver1}=makeVowKit();resolver1.resolve(vow1);// A self vow resolution through promiseconst{vow: vow2,resolver: resolver2}=makeVowKit();constvow2P=Promise.resolve(vow2);resolver2.resolve(vow2P);// A 2 vow loopconst{vow: vow3,resolver: resolver3}=makeVowKit();const{vow: vow4,resolver: resolver4}=makeVowKit();resolver3.resolve(vow4);resolver4.resolve(vow3);// A head pointing to a 2 vow loop (a lasso?)const{vow: vow5,resolver: resolver5}=makeVowKit();resolver5.resolve(vow4);constturnTimeout=asyncn=>{if(n>0){returnPromise.resolve(n-1).then(turnTimeout);}return'timeout';};/** * @param {number} n * @param {Promise<any>} promise */constraceTurnTimeout=async(n,promise)=>Promise.race([promise,turnTimeout(n)]);awaitt.throwsAsync(raceTurnTimeout(20,when(watch(vow1))));awaitt.throwsAsync(raceTurnTimeout(20,when(watch(vow2))));awaitt.throwsAsync(raceTurnTimeout(20,when(watch(vow3))));awaitt.throwsAsync(raceTurnTimeout(20,when(watch(vow5))));});
Expected behavior
No infinite loop
Platform Environment
Additional context
Screenshots
The text was updated successfully, but these errors were encountered:
closes: #9560
## Description
Add a weak set of previously seen vowV0 payloads when shortening during `watch` or `when`
### Security Considerations
None
### Scaling Considerations
Potential churn in storage just for shortening loop detection. Every `watch` will cause a new WeakSetStore to be allocated.
### Documentation Considerations
None
### Testing Considerations
New unit tests
### Upgrade Considerations
To avoid state migration concerns, this needs to be deployed before we start using `watch` more broadly.
Describe the bug
Resolving a vow to itself, either directly or through intermediate promises and/or other vows, result in an infinite loop through shortening.
Unlike promise self resolution which at best result in a data lock when awaited, the consequence here is a full livelock (no other work ends up processed while in the infinite loop)
To Reproduce
Expected behavior
No infinite loop
Platform Environment
Additional context
Screenshots
The text was updated successfully, but these errors were encountered: