P4.1-001: 2s read timeout on accepted sockets (idle preconnect wedged the loop)

A browser speculative preconnection sends no bytes; the sequential
accept loop blocked in read() on it forever while real requests sat in
the backlog — LAN clients saw a dead server while curl (connect+send in
one shot) worked. SO_RCVTIMEO frees the loop. Regression case pinned in
tests/server_http.sx (fails 000 pre-fix, 200 post-fix).
This commit is contained in:
agra
2026-06-12 01:47:30 +03:00
parent 734c00fb98
commit 886b48630b
3 changed files with 31 additions and 0 deletions

View File

@@ -290,6 +290,7 @@ run_server :: (store_dir: string, port: s64) -> !ServeErr {
while true {
client := sock.accept(fd, null, null);
if client < 0 { continue; }
http.set_read_timeout(client, 2);
gpa := GPA.init();
arena := Arena.init(xx gpa, 65536);