Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLS clients currently busy-spin on WANT_READ/WANT_WRITE during the handshake. Against a connected peer that stalls, OpenSSL, Mbed TLS and SecureTransport consume about 48 ms of client-thread CPU during a 50 ms wait. This contributes directly to handshake/reconnect CPU spikes like #525.
Validation: deterministic in-memory tests fail on the old retry loops and pass after the fix, covering read/write backpressure without sleeps, network requests or timeout waits. Adapter suites pass: OpenSSL 238 assertions, Mbed TLS 270, SecureTransport 20. Targeted ThreadSanitizer runs pass, along with three repeated SOCKS5 runs. Full OpenSSL suite: 32/32; Mbed TLS SOCKS5 and TLS-server integration tests also pass. Real handshakes and HTTP responses against a local OpenSSL peer succeed with all three client backends. Production builds as strict C++11 with warnings as errors (legacy SecureTransport deprecation warnings suppressed only in that build).
In the controlled 50 ms stalled-peer profile, warmed client-thread CPU falls from about 48 ms to 0.4–1.4 ms. Cancellation completes within the additional 10 ms readiness interval. The packet capture attached to #525 contains HTTPS connections, but a packet capture alone cannot identify every source of application CPU use; this change fixes the independently reproduced client-handshake spin.
Refs #525. Includes the same narrowly scoped Darwin errno/TSan workaround already validated on #651 and #653, keeping this branch's sanitizer runs reliable.