Skip to content

Commit 391ce69

Browse files
authored
Use threaded HTTP server for test harness. (#24748)
The test `test_offset_converter_pthread` hangs during the `fetch` call to report results to the server. This seems to be caused by Chrome opening an earlier connection to the server and leaving it open which in turn causes pythons`SimpleHTTPRequestHandler` to stop responding to new requests. Using the `ThreadingHTTPServer` allows python to keep processing requests and fixes the hang. More info on this issue can be found in: https://bugs.python.org/issue31639 and the chrome issue https://issues.chromium.org/issues/40978518. Fixes #10232
1 parent 4a14388 commit 391ce69

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from subprocess import PIPE, STDOUT
1010
from typing import Dict, Tuple
1111
from urllib.parse import unquote, unquote_plus, urlparse, parse_qs
12-
from http.server import HTTPServer, SimpleHTTPRequestHandler
12+
from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
1313
import contextlib
1414
import difflib
1515
import hashlib
@@ -2290,7 +2290,7 @@ def log_request(code=0, size=0):
22902290
# do not have the correct MIME type
22912291
SimpleHTTPRequestHandler.extensions_map['.mjs'] = 'text/javascript'
22922292

2293-
httpd = HTTPServer(('localhost', port), TestServerHandler)
2293+
httpd = ThreadingHTTPServer(('localhost', port), TestServerHandler)
22942294
httpd.serve_forever() # test runner will kill us
22952295

22962296

0 commit comments

Comments
 (0)