The host tests found a free port by binding port 0 and closing it, then started the
WebUI's server on it. In between, any connection on the machine can take that port as
its own (the same ephemeral range): the server then exits at once, "Failed to bind to
port N: Address already in use", and the test waited out its window and failed with
"the server did not start" (test_scraper, test_scraper_launchbox) or "HTTP server
exited" (test_webui). It happened in about one gate run in three, under JOBS=4 or not.
tests/webui_build.py start() starts the server, waits for its status and returns the
process, port and session token; a server that exits before answering is started again
on another port (five tries). Every harness that started the server itself uses it:
test_scraper, test_scraper_launchbox, test_scraper_screenscraper, test_webui (its start
and two restarts), test_webui_language, test_webui_transfer_browser. test_scraper's
free_port() had no other user and is gone.
Evidence:
- the cause: 40 sequential starts with each server's stderr kept: 1 failed, "Failed to
bind to port 44505: Address already in use" (exit 1, after 0.02 s); through start(),
40 of 40 started.
- python3 -m unittest tests.test_scraper tests.test_scraper_launchbox
tests.test_scraper_screenscraper: OK; tests.test_webui tests.test_webui_language
tests.test_webui_transfer_browser: 21 tests OK.
- gates on the tree with the next commit: format, unit (210 tests), build, integration
(210 tests), evidence - PASS.