From 903b216fb0d7fb7b46d36dd8f81eec815d6a6ce4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:15 -1000 Subject: Abandon a fill whose last flush fails to write The slot being filled was forgotten before the page's final flush, so a write that failed there, on a full disk for one, could not abandon the fill: cgit died into the lock file instead and the visitor got nothing. The mid-page path already delivered the page from the lock file. --- tests/t0003-cache.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index 4b6a43c..bd186e7 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -227,4 +227,20 @@ test_expect_success 'pages following a branch take the dynamic ttl' ' test_line_count = 2 summary.slots ' +# A write into the lock file that fails on the page's last flush has to end +# as one that fails mid page does, with the fill abandoned and the page +# delivered from the lock file, rather than in a blank response. The limit +# is on files alone, so the page goes to the visitor through a pipe. +test_expect_success 'a failed final write still delivers the page' ' + rm -rf cache3 && mkdir cache3 && + ( + trap "" XFSZ && + ulimit -f 2 && + CGIT_CONFIG="$PWD/bigkeyrc" QUERY_STRING="url=bigpage/" cgit 2>flush.err + ) | cat >flush.out && + grep "^Status: 200" flush.out && + grep "" flush.out && + ! grep "called many times" flush.err +' + test_done -- cgit