- cap 1024 (WO_MAILBOX override at boot): sender-side atomic reserve/release on every path — same-shard, cross-shard envelope, OOM rollbacks; full mailbox traps the SENDER catchably; delivery pop releases; overshoot bounded by in-flight sends (disclosed) - test_mailbox 12/0: exact cap single-threaded, two racing senders win exactly cap slots, drain/refill clean - corpus run/mailbox-full-trap: parked sleeper, send loop catches "actor mailbox full" after >= 1024 sends - pre-existing compiler bug found + fixed: a try ARM yielding a Text PLACE (bare e.msg, try box.field) aliased a register the arm's scope end freed — ASan use-after-free, SEGV on the next unwind's double-walk; emit_try now applies copy_place_text to both arm results; pinned by corpus run/catch-msg-place - db-bench driver: msgrate keeps iteration 22's unbounded-flood contract via WO_MAILBOX=MSG_N (the cap is 24's policy, not 22's) - battery 12/12 fresh-built Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
51 lines
1.2 KiB
Text
51 lines
1.2 KiB
Text
use time
|
|
|
|
-- iteration 24: fail-fast backpressure from .wo. The sleeper parks in its
|
|
-- first receive, so the mailbox only ever drains by one; a send loop must
|
|
-- hit the cap (default 1024) and catch WO_T_ACTOR. The exact send count
|
|
-- at the first trap depends on scheduling, so the fixture prints the
|
|
-- trap's message once plus a bound check, never the count. `try` is an
|
|
-- expression, so the send is wrapped in a helper whose success is nil.
|
|
class Tick {
|
|
n: Int
|
|
}
|
|
|
|
class Sleeper {
|
|
pad: Int
|
|
fn receive(msg: Tick) {
|
|
time.sleep(5000);
|
|
}
|
|
}
|
|
|
|
fn send_one(s: actor Tick, n: Int) -> Text {
|
|
send(s, Tick { n: n });
|
|
return "";
|
|
}
|
|
|
|
fn main() -> Int {
|
|
let s: actor Tick = spawn Sleeper { pad: 0 };
|
|
let sent = 0;
|
|
let caught = "";
|
|
let i = 0;
|
|
while i < 2000 {
|
|
i = i + 1;
|
|
let r = try send_one(s, i) catch (e) e.msg;
|
|
if r == "" {
|
|
sent = sent + 1;
|
|
} else {
|
|
caught = "${r}";
|
|
i = 2000;
|
|
}
|
|
}
|
|
if caught == "actor mailbox full" {
|
|
print("trap: ${caught}");
|
|
} else {
|
|
print("NO TRAP after ${sent} sends");
|
|
}
|
|
if sent >= 1024 {
|
|
print("bounded: cap respected");
|
|
} else {
|
|
print("bounded: TRAPPED EARLY at ${sent}");
|
|
}
|
|
return 0;
|
|
}
|