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
{{ message }}
Repository navigation
A cancel() that arrives while a shield()ed body is parked in delay() wakes it early instead of letting it finish #399
A cancel() that arrives while a shield()ed body is parked in delay() wakes it early instead of letting it finish.
Repro
<?phpusefunctionAsync\async;
usefunctionAsync\spawn;
usefunctionAsync\shield;
usefunctionAsync\delay;
async(function () {
$t0 = hrtime(true);
$t = spawn(function () use ($t0) {
try {
shield(function () use ($t0) {
delay(0.2);
echo'shield body finished after ', (hrtime(true) - $t0) >= 190_000_000 ? 'the full delay' : 'an early wake-up', "\n";
});
} catch (\Async\CancelledException$e) {
}
});
delay(0.02);
$t->cancel();
try { $t->await(); } catch (\Throwable$e) {}
});
Expected (php)
shield body finished after the full delay
Actual (manticore 515a500a, Darwin arm64)
shield body finished after an early wake-up
Tracking
Known-bug repro: tests/aot/repro/wrong/shield_body_woken_early_by_cancel.php — bash tests/aot/xfail.sh -k shield_body_woken_early_by_cancel reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.
Activity
Add repros for ArrayAccess assignment value, Map insert during foreac…
Hold a shielded task's waits against cancel(); deliver it after the s…