HTTPS and REST socket adversity stress gate
Summary¶
Add an Beta 0.7.3 release gate that runs the REST contract and stress matrix over HTTPS and adds hostile socket-level coverage for TLS handshake stalls, partial requests, malformed payloads, and connection resets.
Existing native parser tests and HTTP live stress are strong, but Beta 0.7.3 still needs live HTTPS proof at the socket boundary where legacy Win32/MFC lifetime bugs and mbedTLS WANT_READ/WANT_WRITE handling fail silently.
Risk Being Covered¶
- accepted WebSocket threads surviving stalled TLS handshakes
- handshake or queued-write loops spinning under
WANT_READ/WANT_WRITE - malformed headers or payloads bypassing parser seam coverage in live sockets
- connection resets leaking accepted-client state, handles, or queued responses
- REST worker storms blocking on synchronous UI-thread dispatch
Execution Plan¶
- Add an HTTPS profile variant for the REST live harness with generated or fixture TLS certificate/key material and WebServer HTTPS enabled.
- Run the existing REST contract and mixed stress matrix against
https://127.0.0.1with certificate verification behavior documented for the harness. - Add raw-socket probes for slow TLS ClientHello delivery, stalled handshake, reset during handshake, reset during headers, reset during declared body, and reset during server response send.
- Add malformed live payload probes for invalid UTF-8 JSON, empty JSON body,
non-object JSON, oversized body, overlong headers, duplicate
Content-Length, conflicting duplicate sensitive headers, wrong method, and unsupported content type. - Increase selectable concurrency budgets to include at least 32-client and 64-client stress modes with mixed native REST, qBit-compatible, Torznab, and legacy HTML requests.
- Record request counts, status counts, latency percentiles, timeouts, reset outcomes, accepted-thread drain status, and handle/thread/private-byte deltas.
Acceptance Criteria¶
- [x] full REST contract-stress can run over HTTPS
- [x] HTTPS REST harness profile and generated certificate/key setup are implemented
- [x] stalled and partial TLS handshake probes are implemented
- [x] stalled TLS handshakes are bounded and accepted-client threads drain in live HTTPS artifacts
- [x] reset-before-header and reset-during-body probes are implemented for the live REST/WebSocket socket boundary
- [x] reset-during-response probe is implemented for the live REST/WebSocket socket boundary
- [x] reset-before-header, reset-during-body, and reset-during-response cases do not hang, crash, or leak handles/threads in live artifacts
- [x] malformed duplicate
Content-Length, overlong header, and invalid UTF-8 JSON probes are implemented - [x] malformed live payloads return stable typed errors or deterministic connection closure
- [x] 32-client and 64-client stress budgets complete with zero unexpected timeouts, hangs, non-JSON native REST responses, or process crashes
- [x] latency and resource deltas are emitted in the live report
Progress Evidence¶
- Test harness commit:
ad2ac65. - Test harness commit:
96f4759. - Test harness commit:
e216f44. - Test harness commit:
9e130c3. - Test harness commit:
f00ad31. - Build orchestration commit:
4a531f6. - Build orchestration commit:
a229e6c. - Build orchestration commit:
17dc429. - Added
--rest-socket-adversity-budget {off,smoke}torest-api-smoke.py. - Added raw socket probes for partial-header reset, declared-body reset,
conflicting
Content-Length, overlong headers, and invalid UTF-8 JSON. - Added aggregate live-suite plumbing and workspace entrypoint exposure through
-RestSocketAdversityBudget. - Added
--webserver-scheme {http,https}torest-api-smoke.py, generated one-day local TLS certificate/key material throughopenssl, and configured HTTPS WebServer profile keys for HTTPS runs. - Added aggregate live-suite plumbing and workspace entrypoint exposure through
-RestWebServerScheme. - Added
--rest-tls-handshake-adversity-budget {off,smoke}with HTTPS-only stalled connect-close, partial TLS record reset, and partial ClientHello reset probes. - Added aggregate live-suite plumbing and workspace entrypoint exposure through
-RestTlsHandshakeAdversityBudget. - Added a full-request
reset_during_response_sendraw socket probe to exercise queued-send cleanup after the server starts preparing a response. - HTTPS smoke artifact:
repos\emulebb-build-tests\reports\rest-api-smoke\20260508-120119-eMule-main-release\result.json. The run passed with--webserver-scheme https,--rest-tls-handshake-adversity-budget smoke, three TLS handshake probes, and process resource snapshots after launch and after adversity/stress. - Test harness commit
704a97bpromoted the REST error-path matrix to a hard release gate and addedreset_during_error_response_sendsocket coverage. - App hardening commit
c5a2794raised the bounded WebServer accepted-client thread reserve to128, giving the 64-client release stress target room for bursty TLS turnover without removing the resource cap. - Test harness commit
d6b4f82added retry accounting for transient HTTPS reset/EOF stress failures while keeping connection refused, timeout, and response-shape failures fatal. - HTTPS 32-client contract-stress artifact:
repos\emulebb-build-tests\reports\rest-api-smoke\20260508-201653-eMule-main-release\result.json. The run passed with HTTPS contract-stress, soak stress, 32-way concurrency, and TLS handshake adversity. - HTTPS 64-client contract-stress artifact:
repos\emulebb-build-tests\reports\rest-api-smoke\20260508-202554-eMule-main-release\result.json. The run passed12121requests withfailure_count=0,retry_attempt_count=76,retried_success_count=76,timeout_count=0, andnative_rest_non_json_count=0; TLS handshake probes covered stalled close, partial TLS record reset, and partial ClientHello reset. - HTTP 64-client raw socket adversity artifact:
repos\emulebb-build-tests\reports\rest-api-smoke\20260508-203041-eMule-main-release\result.json. The run passed18520stress requests withfailure_count=0,timeout_count=0, andnative_rest_non_json_count=0; socket probes covered partial-header reset, declared-body reset, conflictingContent-Length, overlong header, reset during response send, reset during error response send, and invalid UTF-8 JSON. - Validation:
python -m pytest tests\python\test_rest_api_smoke.py tests\python\test_live_e2e_suite.py -qpython scripts\rest-api-smoke.py --helppython scripts\run-live-e2e-suite.py --helpgit -C repos\emulebb-build-tests diff --checkgit -C repos\emulebb-build diff --checkpython -m emule_workspace validatepython -m emule_workspace test live-e2e --config Release --platform x64 --suite rest-api --skip-live-seed-refresh --rest-webserver-scheme https --rest-coverage-budget smoke --rest-stress-budget off --rest-socket-adversity-budget off --rest-tls-handshake-adversity-budget smoke --rest-server-search-count 0 --rest-kad-search-count 0 --rest-download-trigger-count 0
Pending Release Evidence¶
- None.