Tcl Source Code

View Ticket
Login
Ticket UUID: 3764f4e81f1483ab554c6d60f8483887bde28221
Title: http11 test suite is unreliable under load
Type: Bug Created on: 2025-09-05 11:34:09
Submitter: rossburton Assigned to: jan.nijtmans
Subsystem: 69. Other Severity: Minor
Priority: 5 Medium Last modified: 2026-11-11 22:29:46
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2026-11-11 22:29:46
Version: 8.6.18, 9.0.5, 9.1.0
Description:

The http11 test suite appears to be unreliable on a loaded system. We're occasionally seeing failures that look like this:

Only running test files that match:  http11.test
Tests began at Thu Aug 21 09:30:07 UTC 2025
http11.test
==== Test with ThreadLevel 0 ====
==== Test with ThreadLevel 1 ====


==== http11-1.8.1 normal, 1.1 and keepalive, server close FAILED
==== Contents of test case:

    set tok [http::geturl http://localhost:$httpd_port/testdoc.html?close=1  -protocol 1.1 -keepalive 1 -timeout 10000]
    http::wait $tok
    list [http::status $tok] [http::code $tok] [check_crc $tok]  [meta $tok connection] [meta $tok transfer-encoding]

---- Result was:
eof {} {crc32 mismatch:  ne 0} {} {}
---- Result should have been (exact matching):
ok {HTTP/1.1 200 OK} ok close {}
==== http11-1.8.1 FAILED

Or:

==== http11-2.10.1.1 -channel,deflate,keepalive,msdeflate FAILED
==== Contents of test case:

    set tok [http::geturl http://localhost:$httpd_port/testdoc.html?msdeflate=1  -timeout 5000 -channel $chan -keepalive 1  -headers {accept-encoding deflate}]
    http::wait $tok
    seek $chan 0
    set data [read $chan]
    list [http::status $tok] [http::code $tok] [check_crc $tok $data] [meta $tok connection] [meta $tok content-encoding] [meta $tok transfer-encoding] [expr {[file size testdoc.html]-[file size testfile.tmp]}]

---- Result was:
eof {} {crc32 mismatch:  ne 0} {} {} {} 130034
---- Result should have been (exact matching):
ok {HTTP/1.1 200 OK} ok {} deflate chunked 0
==== http11-2.10.1.1 FAILED

Or:

==== http11-2.12.1 -channel,negotiate,keepalive FAILED
==== Contents of test case:

    set tok [http::geturl http://localhost:$httpd_port/testdoc.html  -timeout 5000 -channel $chan -keepalive 1]
    http::wait $tok
    seek $chan 0
    set data [read $chan]
    list [http::status $tok] [http::code $tok] [check_crc $tok $data] [meta $tok connection] [meta $tok content-encoding] [meta $tok transfer-encoding] [m
eta $tok x-requested-encodings] [expr {[file size testdoc.html]-[file size testfile.tmp]}]

---- Result was:
eof {} {crc32 mismatch:  ne 0} {} {} {} {} 130034
---- Result should have been (exact matching):
ok {HTTP/1.1 200 OK} ok {} gzip chunked gzip,deflate 0
==== http11-2.12.1 FAILED
User Comments:
serhiy.storchaka added on 2026-10-16 21:36:11:

The failures happen when a new test server gets the same port as an earlier one, so the client reuses a dead persistent socket, and http.tcl does not replay the request: an empty line left after a chunked -channel response is taken as the status line (8.6 too), and in 9.x http::CheckEof can close a socket that a queued request is about to use ("can't read socketWrState(...)", [05b158ed56]). Proposed fix in branch http-keepalive-reuse-closed, test http11-5.1.


jan.nijtmans added on 2026-11-11 22:29:46:

Merged to [98a1b78011|trunk] and core-9-0-branch

Many thanks!