tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Runtime: opt-in virtual time with sockets (issue #293)

http_body_limit_and_write_timeout was flaky under load: a fixed 1000 ms
client sleep assumed the server's 32 MiB write had blocked by then, and
the server's 300 ms write timeout was asserted against a 2 s wall-clock
bound. All margins, no determinism.

Add LOUISE_VIRTUAL_TIME=1 (ADR 0055), a testing knob read once at
scheduler start. With it, io_token() never sets real_start, so the clock
stays virtual despite open sockets; and the idle thread's jump gate is
relaxed: when no actor can run and no blocking call is in flight, it
polls the reactor with a zero timeout and, only if no socket is ready,
jumps the clock to the next timer deadline even while actors are parked
on sockets (socket readiness does not depend on the clock, so a ready
socket is always delivered first). It never sleeps in the poll waiting
for a virtual deadline, and with no timers pending it parks on the
reactor as before, so deadlock detection is unchanged. With the variable
unset, not one behaviour differs.

In the migrated test the blocked 32 MiB write, the parked watchdog and
an otherwise idle scheduler make the 300 ms write timeout fire by a
clock jump, deterministic under any load; the fixture's 4 s shutdown
sleep jumps too, so the test runs in ~0.2 s (was ~2.3 s). The client
waits for the server's "done" line without reading (reading would drain
the buffers and unblock the write), then asserts EOF/reset with fewer
than 32 MiB received, exit 0 and no leaks; a 10 s read timeout and a
15 s kill watchdog remain as backstops. The fixture disables its idle
timeout, which the test does not exercise and virtual time would fire
while a loaded client's request is still in flight.

Runtime tests pin both sides (1 and 4 threads): with the opt-in a
socket does not flip the clock to real time and a timer fires via the
idle jump while an actor is parked on a socket; without it the first
socket still switches to real time.

cargo test -p louise_rt: 67/67. Loom models (handoff, timers, otp,
inbox): 9/9. cargo test -p louise --test cli: 34/34. Soak: the migrated
test 50/50 under full CPU load (22 yes workers); before the fixture and
protocol fixes the same soak caught the idle-timeout-in-flight race
(7/50) and the drain-unblocks-the-write race (1/50), both now closed by
construction.

olivier · il y a 1 mois · 91dddffb7f0b0961c751d187cb4d201b5240ad67

Parents 50a469d

9 fichiers modifiés, 267 ajouts, 19 suppressions