From 91332801ff2334cd887df3971f944b60bebf729c Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sat, 26 Sep 2026 10:46:30 +0100 Subject: Check that lent answers count against the budget Two readers that stop reading keep one 1 MiB answer each waiting on their sockets; a third read must get 503 payload_budget until one of them goes. --- tests/check.py | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/check.py b/tests/check.py index 83afac9..c4484c4 100644 --- a/tests/check.py +++ b/tests/check.py @@ -17,8 +17,9 @@ 9. Server: the HTTP document server running editor.aup answers random requests exactly as the server running editor.pure, on persistent and pipelined connections too; a read lends the stored extents and still - carries its version while the document changes; concurrent edits share - commits, and every acknowledged edit survives kill -9. + carries its version while the document changes, and lent answers count + against the payload budget; concurrent edits share commits, and every + acknowledged edit survives kill -9. 8. Stored state: the list app and the text editor run on a tree store, restarting at random points (every other run saving in bursts), and still match their reference models. @@ -840,6 +841,46 @@ def server_lent_reads(aup, pure, work): return len(big) +def server_lent_budget(aup, pure, work): + """Lent extents count against the payload budget while an answer waits + on its socket. Two readers pipeline 1 MiB reads without reading: the + kernel takes what it can and each reader leaves one answer waiting. A + third request finds no room (503 payload_budget) until a reader goes.""" + import socket + import struct + import time + module = work / 'editor-budget.pmod' + compile_module(aup, ROOT / 'examples/editor.aup', module) + big = bytes(range(256)) * 4096 + budget = 2 * len(big) + len(big) // 2 + host = HttpHost([pure / 'build/pure-serve', '--module', module, '--store', work / 'lent-budget', + '--budget', budget]) + readers = [] + try: + assert host.request('PUT', 'big', struct.pack('