Repository navigation
fix(transport): GC TLS processes after handshake on OTP 28 - #240
Merged
Merged
Conversation
zmstone
reviewed
Nov 10, 2026
zmstone
left a comment
Member
There was a problem hiding this comment.
mind this change: emqx/otp#129
terry-xiaoyu
marked this pull request as ready for review
November 10, 2026 08:14
zmstone
reviewed
Nov 10, 2026
terry-xiaoyu
force-pushed
the
fix/otp28-gc-after-handshake
branch
from
November 10, 2026 09:40
80ad752 to
9dbe7b1
Compare
Contributor
Author
verified on the fork OTP that has it (OTP-28.4.1-11, the builder image pinned by dev-61). With a real server-side handshake through esockd, under both ssl.connection_tree_owner=supervisor and = caller, |
zmstone
reviewed
Nov 10, 2026
OTP 28 changed the sslsocket tuple from 3 to 8 elements. The TLS worker pids now live in the connection_handler and payload_sender fields, so the existing gc/1 clauses matched only OTP<=27 sockets and silently skipped the post-handshake GC on OTP 28. Add a clause for the 8-element shape and share pid de-duplication across the old and new shapes.
terry-xiaoyu
force-pushed
the
fix/otp28-gc-after-handshake
branch
from
November 10, 2026 11:48
9dbe7b1 to
4990d02
Compare
zmstone
approved these changes
Nov 10, 2026
2 of 3 tasks
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.
Summary
gc_after_handshakesilently stopped collecting TLS processes on OTP 28. OTP 28 changed thesslsockettuple from 3 to 8 elements; the TLS worker pids moved to theconnection_handlerandpayload_senderfields, so the existinggc/1clauses matched only OTP <= 27 sockets and fell through to a no-op.Add a clause for the 8-element
sslsocketshape and share pid de-duplication with the legacy 3-element shapes. This restores the OTP <= 27 behaviour on OTP 28. DTLS is covered by the same path (both fields hold the same pid there).Only the TLS worker processes are collected. The per-connection
tls_dyn_connection_supis not: OTP hibernates static supervisors on its own (during init on OTP 24-27, after the default 1 shibernate_afteron OTP 28), so collecting it at handshake would only save memory for the first second on OTP 28, and never on older releases.The option is extracted from
ssl_optionsbeforessl:handshake/2,3, so nothing here changes the OTP option contract.Backport
The commit applies to the 5.17.x line and is needed there for 5.17.10.
Testing
New Common Test cases in
esockd_transport_SUITEdrive a real TLS/DTLS handshake and assert major-GC trace events on the expected TLS worker processes:#proxy_socket{}recursion;dtls_connection_supis not collected;The cases fail on the unfixed source with
missing_gc_majorand pass with the change on OTP 28. The full transport suite andrebar3 xrefpass.