Repository navigation
tls: every proactor started with one TlsOptions shares its context, so a session ticket resumes on any of them (#38) - #54
Merged
Conversation
MDA2AV
added a commit
that referenced
this pull request
Nov 11, 2026
…ptions (#54) count their services, so the last to stop frees the context With #54 every proactor started with one TlsOptions instance shares its context, so the first proactor to stop could no longer free it under the rest. TlsOptions also keeps the ALPN list the context's callback reads and a count of the services on it, under the lock #54 builds it under: start raises the count, free lowers it, and the one that reaches zero frees the context and the list and clears them, so a start after that builds another. Each service still frees its own kTLS handoff buffer, and teardown frees the services after #53's drain, last of all. Tests: TlsResumptionTest runs one-proactor servers on one port through a stop, a later start, and a start after the last stopped; the heap test runs two proactors sharing one options instance.
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.
Closes #38.
Each
TlsServicebuilt its ownSSL_CTX, and so its own ticket keys, whileSO_REUSEPORTpicks the proactor by hashing the connection. A returning client resumed about one time in N, and a miss is a full handshake on the proactor thread.This follows MDA2AV/ioxide#559: the context belongs to the server, not the proactor.
TlsOptionsinstance shares one context, built by the first to start, under a lock taken only at startup. The rest take it.TlsOptionsnow says to hand the same instance to every proactor.Where kron differs.
ConditionalWeakTablekeyed by the options. Common Kotlin has no weak table, so here the context is an internal field on theTlsOptionsinstance.TlsOptionsis a plain class, so identity is what shares, as in ioxide.Test.
TlsResumptionTest(native): 4 proactors on one port, and a TLS 1.2 client returning 20 times with the last session it got. Every return must resume; on main, 5 of 20 did.TlsTestClientgained a session to offer,resumedandsession().With the change.
tlsmodule.