test: serve browser assets without head-of-line blocking

The shared static server handled one connection at a time. Chromium can
open a speculative connection and never send a request, so every queued
request waited behind it. Under parallel load a computed-style capture's
navigation stalled for 30s and failed. Under CPU saturation, 4 of 12
captures stalled for about 29s each.

Serve each connection on a daemon thread. The existing serve-this-worktree
test now holds a silent connection open while it fetches, and times out
against the serial server. The configuration reference's recorded source
lines are unchanged.
This commit is contained in:
Alexandre Teixeira
2026-10-03 03:46:52 +01:00
parent 256beebb3d
commit 77b61c222e
2 changed files with 11 additions and 3 deletions
+7 -1
View File
@@ -7,7 +7,9 @@ running its own suite took the whole session down with it.
import os
import re
import socket
import urllib.request
from urllib.parse import urlsplit
from pathlib import Path
@@ -31,8 +33,12 @@ def test_static_origin_does_not_reuse_the_application_port() -> None:
def test_static_server_serves_this_worktree() -> None:
origin = os.environ["ODYSSEUS_TEST_STATIC_ORIGIN"]
address = urlsplit(origin)
with urllib.request.urlopen(f"{origin}/static/js/documentStats.js", timeout=5) as r:
# Chromium may open a speculative connection and never send a request;
# that must not stall the requests queued behind it.
with socket.create_connection((address.hostname, address.port), timeout=5), \
urllib.request.urlopen(f"{origin}/static/js/documentStats.js", timeout=5) as r:
assert r.status == 200
assert r.headers.get_content_type() == "application/javascript"